Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Null/Is Null 1

Status
Not open for further replies.

Domino2

Technical User
Jun 8, 2008
475
GB
I have 3 related tables in a query. I am trying to get data from tables 1 and 2 if there is no data in the 3rd table (table named Progress)

I have tried looking for Nulls etc etc but cannot work it out. Table 1 - Partners Table 2 - Activities Table 3 - Progress

SELECT PARTNERS.Partner, ACTIVITIES.Type, ACTIVITIES.Status, ACTIVITIES.[Date Raised], PROGRESS.[Updated On], ACTIVITIES.RequestedBy, PROGRESS.Update
FROM (PARTNERS INNER JOIN ACTIVITIES ON PARTNERS.ID1 = ACTIVITIES.ID1) INNER JOIN PROGRESS ON ACTIVITIES.ID3 = PROGRESS.ID3;

Thanks for any suggestions
 
SELECT PARTNERS.Partner, ACTIVITIES.Type, ACTIVITIES.Status, ACTIVITIES.[Date Raised], PROGRESS.[Updated On], ACTIVITIES.RequestedBy, PROGRESS.Update
FROM (PARTNERS
INNER JOIN ACTIVITIES ON PARTNERS.ID1 = ACTIVITIES.ID1)
LEFT JOIN PROGRESS ON ACTIVITIES.ID3 = PROGRESS.ID3
WHERE PROGRESS.ID3 IS NULL

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thankyou PHV, your solution obtained records only where there was nothing in table 3, however I got there from what you did changing to a left join, and now got all the records I am looking for. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top