MS Access中的歧义左联接 [英] Ambiguous left joins in MS Access
本文介绍了MS Access中的歧义左联接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从T-SQL转换以下查询
I want to convert the following query from T-SQL
SELECT
*
FROM
A LEFT JOIN
B ON A.field1 = B.field1 LEFT JOIN
C ON C.field1 = A.field2 AND
C.field2 = B.field2
到Jet SQL.
现在,MS Access不接受模棱两可的查询.我怎样才能做到这一点?我不能将第二个比较放在WHERE
子句中.为什么?因为我的情况是我选择的是C中不存在的记录.
to Jet SQL.
Now MS Access does not accept ambiguous queries. How can I do that? I can't put the second comparison in the WHERE
clause. Why? Because my scenario is that I am selecting records that does not exist in C.
现在,您如何在MS Access中做到这一点?预先感谢您的时间和专业知识.
Now, how do you that in MS Access? Thanks in advance for your time and expertise.
推荐答案
您需要一个派生表才能在MS Access中工作:
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
这篇关于MS Access中的歧义左联接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文