Hey there,
As a developer, you MUST improve your Google-arts :) Check out the below solution, it should help you.
A modified solution from:
Common Solutions for T-SQL[
^]
SELECT
YT.ID,
AgeList = substring((SELECT ( ', ' + RTRIM(LTRIM(STR(YT2.ItemId))))
FROM YourTable YT2
WHERE YT.ID = YT2.ID
ORDER BY
YT2.ID,
YT2.Age
FOR XML PATH( '' )
), 3, 5000)FROM YourTable YT
Hope this helps, regards