select a.id,stuff((select ','+[value] from tb as b where a.id=b.id for xml path('')),1,1,'') [value] from tb as a group by a.id