My table has two columns: id and name. The data looks like this:
id | name
----------
1 Jeff
2 Sam
3 Carl
4 Sam
5 Carl
6 Jeff
7 Dave
8 Jeff
What I want to obtain is this:
name | frequency
----------------
Jeff 3
Carl 2
Sam 2
Dave 1
Essentially, I need an SQL query that counts the unique names within the table, and sorts them by their frequnecy. I'm using MySQL if it matters.
Thank-you.