ambiguous outer join - how to include query in an sql statement

C

cp2599

I need to retrieve attributes from four tables (Fam, House, FamHouse,
and FamHist) in one query. It works find with three of the four
tables, but when I add the fourth table, I get an ambiguous outer join
… create a query that performs the first join and include that query
in your sql statement. How do I include a query in a query?

The relationships are set up as follows

Fam has many FamHistory (linked by FamID)
Fam may have many FamHouse (linked by FamID)
House may have many FamHouse (linked by HouseID)

Key to tables:
tblFam – FamID
tblFamHist – FamID and StartDate – use dtmEndDate is NULL for current
record
tblHouse – HouseID
tblFamHouse – FamID and HouseID and StartDate – use dtmEndDate is NULL
for current record

Here are the two queries I think I want. How do I join them?

SELECT tblFam.chrFamilyName, tblFamHist.dtmApproveDate,
tblFamHouse.dtmWorkDate,
FROM (tblFam INNER JOIN tblFamHist ON tblFam.FamID =
tblFamilyHistory.FamID) LEFT JOIN tblFamHouse ON tblFam.FamID =
tblFamHouse.FamID
WHERE (((tblFamHist.dtmEndDate) Is Null) AND ((tblFamHouse.dtmEndDate)
Is Null));

SELECT tblHouse.chrAddr
FROM tblHouse LEFT JOIN tblFamHouse ON tblHouse.HouseID =
tblFamHouse.HouseID;
 

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