今天要弄一些数据在A表中存在的却不在B表的。。其中的B表的数据一定在A表存在的。。。
一直想把not in (.....) 改成 not exists (.....)
却一直忘了没关联外表...
故记下提醒之...
select * from table1 where not exists (select id from table2 where table1.name=table2.number)
今天要弄一些数据在A表中存在的却不在B表的。。其中的B表的数据一定在A表存在的。。。
一直想把not in (.....) 改成 not exists (.....)
却一直忘了没关联外表...
故记下提醒之...
select * from table1 where not exists (select id from table2 where table1.name=table2.number)
转载于:https://www.cnblogs.com/nate/archive/2011/03/31/2000452.html