Skip to content

Instantly share code, notes, and snippets.

@jaygooby
Created May 31, 2011 10:30
Show Gist options
  • Save jaygooby/1000280 to your computer and use it in GitHub Desktop.
Save jaygooby/1000280 to your computer and use it in GitHub Desktop.
Case statement to increment count()
select lea, SUM(CASE WHEN school_type like '%primary%' THEN 1 ELSE 0 END) as `primary`, SUM(CASE WHEN school_type like '%secondary%' THEN 1 ELSE 0 END) as `secondary` from schools group by lea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment