sql statement to alphabetize and count

database, mysql, php, sql

Solution

I believe something like this will work:

SELECT terms, COUNT( id) AS count 
    FROM table 
GROUP BY terms 
ORDER BY terms DESC

Problem

Here is the mySQL I got ``` id terms 1 a 2 c 3 a 4 b 5 b 6 a 7 a 8 b 9 b 10 b ``` I want to get an alphabetized list sorted by count as follows ``` terms count a 4 b 5 c 1 ``` What mySQL statement do I need for that?

Original source