total multiple sum queries

  • Thread starter Thread starter Dragon
  • Start date Start date
D

Dragon

I have 4 queries that total pounds and cases ship by user specified date, I
want to find the total of the results of these queries.

Is this possible? if so, how?
 
I have 4 queries that total pounds and cases ship by user specified date,I
want to find the total of the results of these queries.

Is this possible? if so, how?

if they're union-compatible (same data types in each column, same
number of columns), then you can union the 4 queries in another query
and then total that.

Your basic union query would look like this (Q1, Q2 are queries) I'm
calling it "MyUnionQuery" (See below):

SELECT ObjectType, Quantity
FROM Q1
UNION ALL
SELECT ObjectType, Quantity
FROM Q2;

Then you would simply total by doing this:
SELECT ObjectType, Sum(Quantity) As TotalQuantity
FROM MyUnionQuery
GROUP BY ObjectType
ORDER BY ObjectType;
 
Back
Top