Query from 2 tables

Gmoz

Registered User.
Local time
Today, 22:22
Joined
Jun 10, 2001
Messages
34
I have two tables with a one to many relationship but not every record has a match on the many side. When I run a query containing both tables and tell the relationship to use all records from the one side and only the records that match from the many side it returns correct execpt when the 1 side has a match only the matches display not the original record from the 1 side.

Table1
ID 1
ID 2

Table2
ID 2 SubID1
ID 2 SubID2

Query display wanted
ID 1
ID 2
ID 2 SubID 1
ID 2 SubID 2

My main result is a report.

Thanks
 
:confused: Hello Gmoz!
I don't know how is your query looks like,
but look at "DemoQry2TA97.mdb".
 

Attachments

Yes that is how I have it now but it displays

ID 1
ID 2 SubID1
ID 2 SubID2

I NEED

ID 1
ID 2
ID 2 SubID1
ID 2 SubID2

See my problem??
 
:rolleyes: OK Gmoz!
It is qute another story.
Look at new "DemoQry2TA97.mdb"
There are Query1 and Query2 (both uppend),
and there is a table tbl1Temp.
First start Quer1, then start Query2.
Look at tbl1Temp. Link your report on that table.
You have to delete records in tbl1Temp before
next start queries.
 

Attachments

I think you can use union query

SELECT PrimaryTable.PkeyID, "" AS ParentID
FROM PrimaryTable
Union Select Subtable.Fkeyid, SubTable.PkeyID
From Subtable;
 

Users who are viewing this thread

Back
Top Bottom