SQL语句修改not in 变为not exists

select t1.id from table1 t1 where tbl1.id not in (select t2.id from table2 t2);

t1有9万条数据,t2有3万条数据 

使用not exists 代替 not in
select t1.id from table1 t1 where not exists (select 1 from table2 t2 where t1.id = t2.id); 

 

posted @ 2020-10-27 08:55  它的眼角开过光  阅读(578)  评论(0编辑  收藏  举报