Ambiguous left joins in MS Access

牧云@^-^@ 提交于 2019-12-01 23:41:13

You need a derived table to make this work in MS Access:

SELECT * 
FROM (
   SELECT A.Field1, A.Field2 As A2, B.Field2 
   FROM A 
   LEFT JOIN B ON A.field1 = B.field1) AS x 
LEFT JOIN C ON  x.A2 = C.field1 AND  x.field2= C.field2 

From Help LEFT JOIN, RIGHT JOIN Operations

You can link multiple ON clauses. See the discussion of clause linking in the INNER JOIN topic to see how this is done.

You can also link several ON clauses in a JOIN statement, using the following syntax:

SELECT fields 
FROM table1 
     INNER JOIN table2 ON table1.field1 compopr table2.field1 
                          AND ON table1.field2 compopr table2.field2)
                          OR ON table1.field3 compopr table2.field3)];

But works this (it seems there is an error in help):

SELECT * 
FROM A 
     LEFT JOIN B ON A.field1 = B.field1
     LEFT JOIN C ON (C.field1 = A.field2 AND C.field2 = B.field2)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!