1

MS ACCESS 中减号查询的正确语法是什么

我想比较 2 个查询的整个结果集,而不仅仅是键列比较

例如:

hello 表数据:id,name,address

hello1 表数据:new_id,new_name,new_address

我想找出在任何列中都有更改数据的所有客户。

我给出了以下查询。它失败了

select h.* from hello h
minus
select h1.* from hello1 h1

请让我知道正确的查询

4

1 回答 1

2

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)

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 & ""

However, it is easier using VBA.

于 2012-07-01T13:47:44.673 回答