total multiple sum queries

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?
 
P

pietlinden

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top