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;

From Redshift query to chart to Slack in seconds

Get to answers faster, together, with PopSQL and Redshift