How to Have Multiple Counts in Snowflake

To do multiple counts in one query in Snowflake, you can combine sum() with the CASE statement:

select
  count(1), -- count all products
  sum(case when name = 'Table' then 1 else 0 end), -- count all tables
  sum(case when category = 4 then 1 else 0 end) -- count all category 4 products
from products
database icon
Shared queries and folders ✅ Version history ✅ One-click connection to Snowflake ✅
Get more done, together, with PopSQL and Snowflake