In Snowflake, for doing multiple counts in a single query, we have to combine “sum()” with “CASE Statement:”
select
count(1),
sum(case when name = ‘Table1’ then one else 0 end),
sum(case when category = 4, then one else 0 end),
from products1
By merging the “CASE” statement and “sum()” function, we can get multiple counts in one query. I hope this is adequate for fetching multiple counts in Snowflake.
Snowflake Related Articles
If you have any queries, let us know by commenting below.
Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!
Name | Dates | |
---|---|---|
Snowflake Training | Aug 05 to Aug 20 | |
Snowflake Training | Aug 08 to Aug 23 | |
Snowflake Training | Aug 12 to Aug 27 | |
Snowflake Training | Aug 15 to Aug 30 |
1 /10
Copyright © 2013 - 2023 MindMajix Technologies