select id, a.name + coalesce('/'+b.name, '') + coalesce('/'+c.name, '') from myTable a left outer join myTable b on a.id=b.id and b.seqno = 2 left outer join myTable c on a.id=c.id and c.seqno = 3 where a.seqno = 1;