Union Query - Group & Sum

G

Gavelle

Below is my union query. The problem i'm having is that it omits two fields
from the three base queries (Num) and (Den). I feel like i'm just on the
edge of figuring this out but every combination i try won't run. How can i
add the Num & Den fields to my union query result?

SELECT [UnitDesc], [Sort Month]
FROM [DirectObserv Compliant Rate BD - By Unit by month]
UNION
SELECT [UnitDesc], [Sort Month]
FROM [DirectObserv Compliant Rate DC - By Unit by month]
UNION SELECT [UnitDesc], [Sort Month]
FROM [DirectObserv Compliant Rate LF - By Unit by month]
GROUP BY [UnitDesc],[Sort Month];
 
J

Jerry Whittle

SELECT [UnitDesc], [Sort Month], [Num], [Den]
FROM [DirectObserv Compliant Rate BD - By Unit by month]
UNION
SELECT [UnitDesc], [Sort Month], [Num], [Den]
FROM [DirectObserv Compliant Rate DC - By Unit by month]
UNION
SELECT [UnitDesc], [Sort Month], [Num], [Den]
FROM [DirectObserv Compliant Rate LF - By Unit by month]
GROUP BY [UnitDesc],[Sort Month];
 

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