多表联合查询sql语句查询性能优化
1、多表联合查询的sql语句:
复制代码 代码示例:
select table1.ID from table1 inner join table2 on table1.ID=table2.ID
where table2.col2='xxx'
2、改进后的多表联合查询语句:
复制代码 代码示例:
select a.ID from table1 a,
(select col1,ID from table2 where col2='xxx') b
where a.ID=b.ID