How do I write this GROUP BY query in MYSQL?

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-04-13T22:32:49Z Indexed on 2010/04/13 22:43 UTC
Read the original article Hit count: 299

Filed under:
|
|

Suppose I have a column called "fruits" I want to select all of the top fruits, ranked by fruits (and group by + count).

Fruits:
orange
orange
apple
banana
apple
apple

In this case, the select statement would return:

apple, 3
orange, 2
banana, 1

© Stack Overflow or respective owner

Related posts about mysql

Related posts about database