我也来问点基础的问题
最近在优化SQL语句时,碰到一些怪的现象,所以请高手指点一下。
例如下面的简单语句:
select a.id_a, b.id_b, c.id_c
from table_a a, table_b b, table_c c
where a.id_a = b.id_a and b.id_b = c.id_b
and a.lb = '1' and b.lb = '2' and c.lb = '3'
select a.id_a, b.id_b, c.id_c
from (select * from table_a where lb = '1') a
, (select * from table_b where lb = '2') b
, (select * from table_c where lb = '3') c
where a.id_a = b.id_a and b.id_b = c.id_b
select a.id_a, b.id_b, c.id_c
from (select id_a from table_a where lb = '1') a
, (select id_a, id_b from table_b where lb = '2') b
, (select id_b, id_c from table_c where lb = '3') c
where a.id_a = b.id_a and b.id_b = c.id_b