select a.id table1_id,(select name from table2 where id=a.code_id)code_name,(select name from table2 where id=a.type_id) type_name from table1 a;
select a.id table1_id,b.name code_name,c.name type_name from table1 a,table2 b,table2 c where a.code_id=b.id(+) and a.type_id=c.id(+)
railgunman(堕落男人): 有个小错误,不是a.name as code_name,是b.name as code_nameselect a.id as table1_id, b.name as code_name, c.name as type_name from table1 a, table2 b, table2 c where a.code_id=b.id and a.type_id=c.id
name from table2 where id=a.type_id) type_name from table1 a;
where a.code_id=b.id(+) and a.type_id=c.id(+)
有个小错误,不是a.name as code_name,是b.name as code_nameselect a.id as table1_id, b.name as code_name, c.name as type_name
from table1 a, table2 b, table2 c
where a.code_id=b.id and a.type_id=c.id