Created
January 12, 2016 15:09
-
-
Save belsrc/fad19c307451d48190a5 to your computer and use it in GitHub Desktop.
Get total for each distinct value query
This file contains 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
-- Get a count of people in each city from a specific state | |
SELECT DISTINCT(city) AS city, COUNT(city) AS total | |
FROM data | |
WHERE state = ? | |
GROUP BY city | |
ORDER BY city ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment