select a.id,c.name,a1.name,b1.name from table2 c,table1 a
left join table2 a1 on a.friend1 = a1.id
left join table2 b1 on a.friend2 = b1.id
where a.id = c.id;

解决方案 »

  1.   

    select B.id,B.name,A.friendid1,A.friendid2 from table1 A,table2 Bwhere A.id(+) = B.id;
      

  2.   

    select a.friendid1, a.friendid2, b.name, c.name, d.name
      from table1 a, table2 b, table2 c,table2 d
     where a.id = 'xxxxx' 
       and b.id = a.id 
       and c.id = a.friendid1(+) 
       and d.id = a.friendid2(+)
      

  3.   

    不行的话就反过来
    -------------------------
    select a.friendid1, a.friendid2, b.name, c.name, d.name
      from table1 a, table2 b, table2 c,table2 d
     where a.id = 'xxxxx' 
       and b.id = a.id 
       and c.id(+) = a.friendid1 
       and d.id(+) = a.friendid2