I am wondering how to write this query.
I know this actual syntax is bogus, but it will help you understand what I am wanting. I need it in this format, because it i
SELECT distributor_id, COUNT(*) AS TOTAL, COUNT(IF(level='exec',1,null)), COUNT(IF(level='personal',1,null)) FROM sometable;
COUNT only counts non null values and the DECODE will return non null value 1 only if your condition is satisfied.
COUNT
non null
DECODE
1