日期:2014-05-17 浏览次数:20886 次
select a.* from a where not exists(select 1 from b where a.id=b.id)
------解决方案--------------------
select a.* from a where a.id not in (select id from b)
------解决方案--------------------
select * from a where a.id not in(select b.id from b);
------解决方案--------------------
select a.* from a
where not exists (select 1 from b where a.id=b.id);
select a.* from a where a.id not in(select b.id from b);
兩個都行,如果B表中資料較多,用exists.