Unwanted extra results from Select Query

Oscar_W

Registered User.
Local time
Today, 05:58
Joined
Mar 9, 2006
Messages
42
Hi,

I am a novice with Access and would like a steer with what I am sure is a simple issue but I can't find an answer. :confused:
I currently have 2 queries based on 2 separate tables.

Ops_Log_996_Query
SELECT [996_Table].Unit, [996_Table].Location, [996_Table].hiredate
FROM 996_Table
WHERE ((([996_Table].hiredate)=Date()));

Ops_Log_SQTU_Query
SELECT SQTU_Table.Unit, SQTU_Table.Location, SQTU_Table.hiredate
FROM SQTU_Table
WHERE (((SQTU_Table.hiredate)=Date()));


When run separately the first query returns 2 results and the other 1 result - fine so far.
I am now trying to combine the results for display in a report so I have a third query which takes its info from the first two -

SELECT DISTINCTROW Ops_Log_996_Query.Unit, Ops_Log_996_Query.Location, Ops_Log_996_Query.hiredate, Ops_Log_SQTU_Query.Unit, Ops_Log_SQTU_Query.Location, Ops_Log_SQTU_Query.hiredate
FROM Ops_Log_996_Query, Ops_Log_SQTU_Query
GROUP BY Ops_Log_996_Query.Unit, Ops_Log_996_Query.Location, Ops_Log_996_Query.hiredate, Ops_Log_SQTU_Query.Unit, Ops_Log_SQTU_Query.Location, Ops_Log_SQTU_Query.hiredate;

This displays the 2 separate records in the first 3 columns ok but in the last 3 columns the info in record 2 is a repeat of record 1. :confused:

Can anyone help me out please ?
Thanks, Oscar
 
1. Your join is unspecified and so will create a Cartesian product. A Cartesian product matches every row from tblA with every row from tblB and is useless for most purposes because of the excessive duplication.
2. I don't think you want to join the two queries but you might want to union them. What is the relationship between the two tables? What, exactly, are you expecting the result set to look like?
 
Pat, hey thanks for the fast response.
The desired end result is a report where I would like to display all of the tasks (996, SQTU and several more to follow) in their own group based on the date selected.
I first tried to pull the individual queries into different fields of the report but that wouldn't work, so I thought I would have to combine the info into one place before display.

I naively assumed the info would look like this:
996 result 1 SQTU result 1
996 result 2 (blank)
 

Users who are viewing this thread

Back
Top Bottom