I currently have a table with a 'category' field, which is an integer. What I'd like to do is show a descending list of which categories have the most entries.
For example, assume this is my table:
id name
1 Jeff
1 Chris
2 Susan
3 Phil
3 Cameron
3 Dave
I'd like to return, in the proper order, '3, 1, 2', as well as how many entries are using that ID. I'd like something returned that is something like this:
ID Rows
3 3
1 2
2 1
GROUP BY works to an extent, but I'm unsure of how to sort it descending as I showed.
Any help would be appreciated.