SQL优化系列——子查询

sql调优方法:

1)not in子查询优化

尽量避免子查询select * from a where id not in(select id from b);

select * from a where not exists(select id from b WHERE id ='100')

建议使用表连接:

select * from a left join b on a.id=b.id WHERE b.id='100'

posted on 2017-05-16 14:17  力奋  阅读(309)  评论(0编辑  收藏  举报