SELECT t.PROB_ID, STUFF(
(SELECT ',' + s.NOTES
FROM gpcomp1.GPPROBNOTES s
WHERE s.PROB_ID = t.PROB_ID
FOR XML PATH('')),1,1,'') AS NOTES
FROM gpcomp1.GPPROBNOTES AS t
GROUP BY t.PROB_ID
SELECT t.PROB_ID, STUFF(
(SELECT ',' + s.NOTES
FROM gpcomp1.GPPROBNOTES s
WHERE s.PROB_ID = t.PROB_ID
FOR XML PATH('')),1,1,'') AS NOTES
FROM gpcomp1.GPPROBNOTES AS t
GROUP BY t.PROB_ID