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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left Join Problem?

Status
Not open for further replies.

SchoonDog

Programmer
Joined
Dec 13, 2002
Messages
10
Location
CA
My SQL looks like this:

SELECT tblname1.field1,tblname2.field2,tblname3.field3,tblname4.field4
FROM ((tblname1 LEFT JOIN tblname2 ON tblname1.field1=tblname2.field2) LEFT JOIN tblname3 ON tblname2.field2=tblname3.field3) LEFT JOIN tblname4 ON tblname3.field3=tblname4.field4;

Can anyone tell me why this isn't working?

Any help would be excellent.
Thanks,
SD


 
Try building this in the qbe grid and see how access formats it. My thinking is that you've got the parens wrong.

Access is locked up in a long query process for me right now, so I can't get in to look, but generally the FROM clause looks more like this:
FROM tbl1 LEFT JOIN (tbl2 LEFT JOIN (tbl3 LEFT JOIN tbl4 ON tbl3.PK = tbl4.FK) ON tbl2.PK = tbl3.FK) ON tbl1.PK = tbl2.FK

As I said, Access is busy now, so I can't test this, but I think it's right.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developers' section of the site for some helpful fundamentals.
 
In what way is it not working? Wrong results? Error? Other?
 
It actually gives me an ODBC error. The weird thing is that when I remove the last left join it works fine.

ODBC problem or SQL?

Thanks,
SD
 
ODBC? Are these linked tables? What database?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top