SQL联表查询优化

原SQL
select * from A a
left join B b on a.id=b.id

优化SQL
select * from (select aa,bb from A where aa='') a
left join (select aa,bb from B where aa='') b on a.id=b.id

 

或使用临时表先查,然后再关联。

posted @ 2024-01-17 16:13  妖狐鬼魅  阅读(9)  评论(0编辑  收藏  举报