Tuesday, April 17, 2012

mysql Count the Distinct example

like:
ari
ari
dani
ari
I want select like this:
ari     3
dani  1
SELECT   my_column,  
COUNT(*) AS num
FROM my_table
GROUP BY  my_column
ORDER BY COUNT(*) DESC
thanks stack overflow

No comments:

Post a Comment