日期:2014-05-18  浏览次数:20596 次

急求一SQL语句,谢谢!!
有两个数据库A和B,通过C字段关联,C字段为字符型,代表单位编码,求一SQL语句能查找出在B数据库C字段中存在,但是在A数据库C字段的记录中不存在的单位编码,谢谢!!

------解决方案--------------------
方法1---
select 1 from B left join A on A.c=B.c
where A.c is null

方法2---
select 1 from A right join B on A.c=B.c
where A.c is null

方法3---
select * from B where NOT EXISTS(select * from A where A.c=B.c)

方法4---
select * from B where c NOT IN(select c from A)