select ID,Name, TEST = STUFF((SELECT ';'+xx FROM emps where ID=t.ID FOR XML PATH('')),1,1,'') from emps t group by ID,Name