[Quote=引用 1 楼 friendxxy 的回复:]
left join 左连接 如果是单纯两表left join的话,这种在结构上一般不优化 主要是看看索引了 速度慢说明你表很大嘛
select * from tablea a inner join tableb b on a.id=b.aid 就相当于 select * from tablea a,tableb b where a.id=b.aid
[/Quote]
select * from tablea a inner join tableb b on a.id=b.aid 就相当于 select * from tablea a,tableb b where a.id=b.aid
这两个有什么区别没有,执行速度怎样?
个人认为left join 写的好的话并不会特别慢。即不要在left join 中用大量复杂的关联子查询
比如:
select A.*,t.* from A
left join (
select B.* from B
) t on t.aid = a.id
这样的话,必然里面是一个全表的数据返回,就很影响效率了
left join 左连接 如果是单纯两表left join的话,这种在结构上一般不优化 主要是看看索引了 速度慢说明你表很大嘛
select * from tablea a inner join tableb b on a.id=b.aid 就相当于 select * from tablea a,tableb b where a.id=b.aid