MsAccess中的减号查询 [英] Minus Query in MsAccess
问题描述
MS ACCESS中减号查询的正确语法是什么
What is the correct syntax for Minus Query in MS ACCESS
我想比较2个查询的整个结果集,而不仅仅是键 列比较
I want to compare entire result set of 2 queries not just only key column comparisons
例如:
您好表格数据:id,名称,地址
hello table data: id,name,address
hello1表数据:new_id,new_name,new_address
hello1 table data: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
请让我知道正确的查询
推荐答案
一种可能性不在. MS Access中没有负号查询.
One possibility is NOT IN. There is no such thing as a minus query in MS Access.
select h.* from hello h
WHERE uniqueid NOT IN
(select uniqueid from hello1 h1)
对于纯sql解决方案,您需要说:
For a purely sql solution, you need, say:
SELECT t.* FROM Table t
LEFT JOIN NewTable n
ON t.ID = n.ID
WHERE t.Field1 & "" <> n.Field1 & ""
OR t.Field2 & "" <> n.Field2 & ""
但是,使用VBA更容易.
However, it is easier using VBA.
这篇关于MsAccess中的减号查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!