Getting multiple dynamic counts on a single column
Moderator: General Moderators
Getting multiple dynamic counts on a single column
Is there some method to return a single row with multiple COUNTS on single column based on different values matching that column?
Since the counts in the field clause are tied to a single where clause, you will need to do this with subqueries like
Code: Select all
SELECT
( SELECT COUNT(*) FROM tbl WHERE something=something) as myFirstCount,
( SELECT COUNT(*) FROM tbl WHERE something=somethingelse) as mySecondCount