Last active
August 29, 2015 14:26
-
-
Save kirilkirkov/10d4616481afe9e2aab4 to your computer and use it in GitHub Desktop.
Get num of categories for every type..
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
SELECT SUM(IF(category_id=1,1,0)) as category_one, SUM(IF(category_id=2,1,0)) as category_two, SUM(IF(category_id=3,1,0)) as category_three, SUM(IF(category_id=4,1,0)) as category_four, SUM(IF(category_id=5,1,0)) as category_five, SUM(IF(category_id=6,1,0)) as category_six, SUM(IF(category_id=7,1,0)) as category_seven, SUM(IF(category_id=8,1,0)) as category_eight, SUM(IF(category_id=9,1,0)) as category_nine, SUM(IF(category_id=10,1,0)) as category_ten, SUM(IF(category_id=11,1,0)) as category_eleven, SUM(IF(category_id=12,1,0)) as category_twelve FROM my_table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment