[AccessD] SQL Question

jscott at mchsi.com jscott at mchsi.com
Fri May 16 13:29:52 CDT 2003


Can anyone tell me why when I use an inner join on the below query I get 
records back from Table A and Table B but when I use a left join I get no 
records from Table B - even though they appeared when I used the inner join. In 
other words:

Record 1 exists in both Table A and Table B. Using an inner join I get Record 1
Using a left join brings me back no records!

I need to return the records like this

Record 1 exists in both tables - returns record 1 using left outer join
Record 2 only exists in Table A - returns record 2 using left outer join

I've written left joins thousands of times - what is so different about this 
time???

SQL using Left Join
SELECT tblCompany.CoID, qrySubmits_CollectingCoMaxSubmit.MaxOfSubmittedDt, 
qrySubmits_CollectingCoMaxSubmit.CollectingCoID
FROM tblCompany LEFT JOIN qrySubmits_CollectingCoMaxSubmit ON tblCompany.CoID = 
qrySubmits_CollectingCoMaxSubmit.CollectingCoID;

SQL using Inner Join
SELECT tblCompany.CoID, qrySubmits_CollectingCoMaxSubmit.MaxOfSubmittedDt, 
qrySubmits_CollectingCoMaxSubmit.CollectingCoID
FROM tblCompany INNER JOIN qrySubmits_CollectingCoMaxSubmit ON tblCompany.CoID 
= qrySubmits_CollectingCoMaxSubmit.CollectingCoID;

Thanks!!
Jeanine







More information about the AccessD mailing list