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!
|Snowflake Training||Sep 26 to Oct 11||View Details|
|Snowflake Training||Sep 30 to Oct 15||View Details|
|Snowflake Training||Oct 03 to Oct 18||View Details|
|Snowflake Training||Oct 07 to Oct 22||View Details|
Copyright © 2013 - 2023 MindMajix Technologies