合肥一中2017高考成绩:如何在access中用SQL语句求差集?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/30 15:28:18
在access中可以用Union求并,但是怎么求差呢?用except或者not exists好像都不识别。

推荐使用outer join

比如有2个表 table1和Table2
都有两个字段content
查询内容在table1但不在table2中的数据的语句是
select table1.*
from table1 left outer join table2
on table1.content=table2.content
where table2.content is null

反过来查询在table2不在table1中,则语句为
select table2.*
from table1 right outer join table2
on table1.content=table2.content
where table1.content is null