Sql Query to get total rows and total rows matching specific condition
- by mrNepal
OK, Here is what my table looks like
------------------------------------------------
id type
-----------------------------------------------
1 a
2 b
3 a
4 c
5 c
7 a
8 a
------------------------------------------------
Now, I need a query that can give me this output...
-----------------------------------------------------------------
count(*) | count(type=a) | count(type=b) | count(type=c)
-----------------------------------------------------------------
8 4 1 3
------------------------------------------------------------------
I only know to get the total set using count(*), but how to do the remaining