select a.id as table1_id, a.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

解决方案 »

  1.   

    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;
      

  2.   

    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(+)
      

  3.   

    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