MySQL not in 优化方案
MySQL not in 优化方案原sql如下:select idfrom Awhereid not in ( select id fromB where name = 'zhangsan' );优化后sql:select A.idfrom Aleft join ( select id from B where name = 'zhangsan' ) Bon A.id = B.idwhereB.i
·
MySQL not in 优化方案
原sql如下:
select id
from A
where
id not in ( select id from B where name = 'zhangsan' );
优化后sql:
select A.id
from A
left join ( select id from B where name = 'zhangsan' ) B
on A.id = B.id
where
B.id is null;
更多推荐
已为社区贡献4条内容
所有评论(0)