2
5
select a.id,b1.name as name1,b2.name as name2 from a left join b b1 on a.T_ID=b1.ID left join b b2 on a.S_ID=b2.ID