Created
May 31, 2012 14:19
-
-
Save felipelavinz/2843682 to your computer and use it in GitHub Desktop.
group results by frequency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# originally seen on: http://psoug.org/snippet/Grouping_rows_by_frequency_299.htm | |
SELECT DISTINCT field_name, COUNT(*) AS num | |
FROM table_name | |
GROUP BY field_name | |
ORDER BY num DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment