--A表大,B表小,效率高select*from A where ID in (select ID from B)
--A表小,B表大,效率高select*from A as TA whereexists(select1from B as TB where TB.ID = TA.ID)
--not in 全表扫描
--not exists 会用到索引
--A表大,B表小,效率高select * from A where ID in (select ID from B)--A表小,B表大,效率高select * from A as TA where exists(select 1 from B as TB where TB.ID = TA.ID)--not in 全表扫描--not exists 会...