How to Have Multiple Counts in Redshift

To do multiple counts in one query in Redshift, you can combine COUNT() with CASE:

  count(1), -- count all users
  count(case when gender = 'male' then 1 else 0 end), -- count male users
  count(case when beta = true then 1 else 0 end) -- count beta users
  count(case when beta = false then 1 else 0 end) -- count active non-beta users
from users;
database icon
SQL editing that just rocks
PopSQL and Redshift, better together