mysql 优化

2018-04-18  本文已影响0人  智勇双全的小六
  1. 用 join 代替子查询
    子查询
 select distinct(value) from tableName where name='minor_version' 
and custins_id in (select id from tableName2 where parent_id=%s); 

join

select distinct(value) from tableName as t1
join tableName2 as t2 on t1.custins_id = t2.id
where t1.name='minor_version' and t2.parent_id=%s
上一篇下一篇

猜你喜欢

热点阅读