I will record what I learned when I have to write several counts in several conditions with SQL. There were two ways to do that. 01. Use Function Count and if clause. It's simple we will combine function 'COUNT' with 'if' clause. You can omit 'GROUP BY' clause depend on your needs. COUNT(expression) FROM table_name GROUP BY column_name; if(condition, value for true, value for false) Here is a ex..