Table: Food
+------+------+
|Person| Food |
+------+------+
| A | Apple|
| A | Bread|
| A | Bread|
| A | Bread|
| B |Orange|
| B |Orange|
| B |Orange|
| C |Orange|
| C |Orange|
+------+------+
How do you find the the most frequent food a person ate and how many times he ate it. The output would be something like
A - Bread - 3
B - Orange - 3
C - Orange - 2
I have tried this. But right now the count just gives the amount of food he ate and not the most frequent one.
SELECT PERSON,FOOD, COUNT(FOOD)
FROM FOOD
GROUP BY FOOD
ORDER BY COUNT(FOOD)