... SUM( CASE WHEN status = 1 THEN 1 ELSE 0 END ) AS Status1Count, SUM( CASE WHEN status = 2 THEN 1 ELSE 0 END ) AS Status2Count, ...>Thanks for the sample. I needed to count the number of customer instead of summing the sales, so I tried to modify your snipped like below:
>... >COUNT( CASE WHEN status = 1 THEN status END ) AS Status1Count, >COUNT( CASE WHEN status = 2 THEN status END ) AS Status2Count, >... >>