Joining two Queries to get ALL data

B

brian

I have two queries which are being used to get a count of "Target Met" and
"Target Missed". Each query has a column for Person and a column with the
count. What I want to do is bring the two queries together to display three
columns (person, count met, count missed). When I run it, I'm not getting
the full dataset for the table (I add the two counts together and the total
is not equal to the # of records in the table). Can this be done (note that
there is no key)? Below are the queries being used:

TARGET MET QUERY
****************
SELECT Avg(FEB08.MINUTES) AS [Avg MINUTES], Count(*) AS [COUNT],
FEB08.PERFORMED_BY
FROM FEB08
WHERE (((FEB08.MINUTES)<=60))
GROUP BY FEB08.PERFORMED_BY;

TARGET MISSED QUERY
****************
SELECT Avg(FEB08.MINUTES) AS [Avg MINUTES], Count(*) AS [COUNT],
FEB08.PERFORMED_BY
FROM FEB08
WHERE (((FEB08.MINUTES)>60))
GROUP BY FEB08.PERFORMED_BY;


FINAL TARGET QUERY
****************
SELECT TARGET_MET_QUERY.PERFORMED_BY, TARGET_MET_QUERY.COUNT AS [# OF EVENTS
MET], TARGET_MISSED_QUERY.COUNT AS [# OF EVENTS MISSED]
FROM TARGET_MET_QUERY LEFT JOIN TARGET_MISSED_QUERY ON
TARGET_MET_QUERY.PERFORMED_BY=TARGET_MISSED_QUERY.PERFORMED_BY;
 
G

Gary Walter

Hi Brian,

In addition to Golfinray's sage help,
I might create an additional query that
gives me every PERFORMED_BY
from FEB08, say "qryDistinctPB

SELECT DISTINCT PERFORMED_BY
FROM FEB08;

then left join this query to your 2 queries, i.e.,
join option to...

"Show me all 'qryDistinctPB" and any matches
to 'TARGET_MET_QUERY'"

good luck,

gary
 

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