Count unique values of one column

from the Artful Common Queries page


SELECT col_name, COUNT(*) AS frequency 
FROM tbl_name
GROUP by col_name
ORDER BY frequency DESC;

Last updated 22 May 2009




Return to the Artful Common Queries page