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;
left join table2 a1 on a.friend1 = a1.id
left join table2 b1 on a.friend2 = b1.id
where a.id = c.id;
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(+)
-------------------------
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