MyBatis知识梳理
2018-11-24 本文已影响0人
郝小发的生活
select * from aaa a where exists (select * from bbb b where b.id=a.id)
相当于
select * from aaa where id in (select id from bbb)
加 NOT 相当于
select * from aaa where id not in (select id from bbb)
只是exists的执行效率比in高的多,in要去匹配全表,exists只匹配索引