我需要一些关于在Access中创建两个不同但相关的查询的指导:
答案 0 :(得分:0)
1:注意括号(您也可以在连接中执行此操作,但我的首选项在where语句中)这是近似代码,Access SQL的语法可能稍微偏离,但它应该有助于指向正确的方向。
WHERE ((table1.fieldA = table2.fieldB
AND table1.fieldA = table2.fieldC) OR
table1.fieldA = table2.fieldD)
2:
FROM table1
LEFT JOIN Table2
ON (table1.fieldA = table2.fieldB
AND table1.fieldA = table2.fieldC)
OR table1.fieldA = table2.fieldD
WHERE (IS NULL table2.fieldB AND
IS NULL table2.fieldC)
OR IS NULL table2.fieldD