My MySQL table is as follows:
ID term timestamp
1 foo xxxx
2 bar xxxx
3 bar xxxx
4 foo xxxx
5 foo xxxx
6 foo xxxx
7 xxx xxxx
I wish to produce a list displaying the most common terms in order of quantity of that term
i.e. the end result:
foo
bar
xxx
What query should I use ? I’ve done some googling, but I’m not quite sure what I’m looking for – COUNT / GROUP BY etc.
The following SQL query should provide a solution to your problem.