SQL 替换not in

原句:

select * from aa where id not in(select id from bb)

替换:

select cc.id,cc.value from (select aa.*,bb.id as tempcolum from aa left join bb on aa.id=bb.id) as cc where cc.tempcolum is null

原文地址:https://www.cnblogs.com/ruanyifeng/p/2593045.html