Sum of a UNION Query

H

Hendy88

Hello,

I want to sum the values together that are returned from the following
two queries joined with a UNION from within the same query (instead of
creating a second query that will SUM the two values that are produced
from this one). I tried "wrapping" this code within a SELECT SUM, but
it returns with "this is not allowing in subqueries".

SELECT Count(*) AS SubCount
FROM [TABLE1]
WHERE (([TABLE1].USER)="JOHNSMITH")
UNION ALL SELECT Count(*) AS SubCount
FROM [TABLE2]
WHERE (([TABLE2].USER)="EJONES");

The results are:

SubCount
--------------
380
45

But, as I mentioned, from with the same query I want the following:

SubCount
--------------
425

Any ideas?

Thanks in Advance!
 

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

Similar Threads


Top