Try this, SELECT DISTINCT ID, STUFF((SELECT ','+ CONVERT(VARCHAR(30), name) FROM tablename AS S2 WHERE S1.ID = S2.ID FOR XML PATH('')), 1, 1, '') AS Name FROM tablename AS S1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)