SELECT t.PROB_ID, STUFF((SELECT ',' + s.NOTESFROM gpcomp1.GPPROBNOTES sWHERE s.PROB_ID = t.PROB_IDFOR XML PATH('')),1,1,'') AS NOTESFROM gpcomp1.GPPROBNOTES AS tGROUP BY t.PROB_ID