I have 2 queries which perform aggregates (sum) on the same column, depending on the value of a different column in the same table - similar to this:
The actual queries are slightly more involved than that, but the idea is to return two values - a total where paper size is Letter and a total where paper size is other than Letter.
Is it possible to combine these 2 queries into a single query that returns both values?
I am trying to find ways to make my code more efficient, and it seems like one query ought to be more efficient than two.
Thanks!
Code:
SELECT SUM(TotalCount) WHERE PaperSize = "Letter"
SELECT SUM(TotalCount) WHERE PaperSize <> "Letter"
The actual queries are slightly more involved than that, but the idea is to return two values - a total where paper size is Letter and a total where paper size is other than Letter.
Is it possible to combine these 2 queries into a single query that returns both values?
I am trying to find ways to make my code more efficient, and it seems like one query ought to be more efficient than two.
Thanks!