如何在access中查询同结构2个数据表中数据不同的字段

来源:百度知道 编辑:UC知道 时间:2024/07/05 09:08:27
access中有表A和B,其中字段相同(c,d,e),其中c为主键,怎么用一个SQL查询其中不同的数据?

方法一:分别找出
--A不在B中的
select * from A where c not in (select c from B)
--B不在A中的
select * from B where c not in (select c from A)

或者
方法二:

select * from A into #temp
insert into #temp
select * from B
select * from #temp group by c,d,e having count(c)<2
drop table #temp

ps:这些都是在sql 2000下实现的
lz可以根据需要自己改~~