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); 
原文地址:https://www.cnblogs.com/Mandy-ZQ-Ma/p/13882842.html