I order the column from max repeats to min. But I only want to get the top value. The value that repeats the most.
This is code:
SELECT foreign_key
FROM all_person
GROUP BY foreign_key
ORDER BY COUNT(*) DESC;
And this is what I get:
foreign_key
--------------
10
9
2
4
8
3
7
6
1
5
I only want to get value 10 (in this example). I saw alot of times that people use LIMIT but I get and error if I use LIMIT like that:
ORDER BY COUNT(*) DESC LIMIT 1;
And this is error:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"