I have one table with following columns:
ListID---- Status
1--------- YES
2--------- YES
3---------- NO
I want to write an SQL statement which will return count for each ListID column having Status as “YES”.
How do I create this SQL statement, so that I get ListID 3 in it with Count as 0?
Please let me know.
Use MySQL IF-function:
If the Status is YES, count the field. Else don’t count it (0).
Checkout this previous answer: Get paid cash amount grouped by day