database MsAccess 中的减号查询
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11282433/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Minus Query in MsAccess
提问by logan
What is the correct syntax for Minus Query in MS ACCESS
MS ACCESS 中减号查询的正确语法是什么
I want to compare entire result set of 2 queries not just only key column comparisons
我想比较 2 个查询的整个结果集,而不仅仅是键列比较
For Eg:
例如:
hello table data: id,name,address
hello1 table data:new_id,new_name,new_address
hello 表数据:id、name、address
hello1 表数据:new_id,new_name,new_address
I want to find out who are all the customers with changed data in any column.
我想找出在任何列中更改数据的所有客户。
I had given following query .it failed
我给出了以下查询。它失败了
select h.* from hello h
minus
select h1.* from hello1 h1
Please let me know correct query
请让我知道正确的查询
回答by Fionnuala
One possibility is NOT IN. There is no such thing as a minus query in MS Access.
一种可能性不在。MS Access 中没有减号查询之类的东西。
select h.* from hello h
WHERE uniqueid NOT IN
(select uniqueid from hello1 h1)
For a purely sql solution, you need, say:
对于纯 sql 解决方案,您需要说:
SELECT t.* FROM Table t
LEFT JOIN NewTable n
ON t.ID = n.ID
WHERE t.Field1 & "" <> n.Field1 & ""
OR t.Field2 & "" <> n.Field2 & ""
However, it is easier using VBA.
但是,使用 VBA 更容易。

