Is it possible in MySQL to do something like this:
SELECT COUNT(*) as totalcount,
COUNT(*) WHERE foo IS NULL as conditional_count
FROM baz
i.e. get two counts, one of everything, and one of things matching a WHERE clause, in a single select?
This would work if your database supports the CASE WHEN statement, otherwise you’ll still get the basic idea.