Ответ 1
попробуйте это
SELECT T1.STUDENTID,
STUFF((SELECT ',' + CONVERT(VARCHAR(50), NOTE) + ','
+ CONVERT(VARCHAR(50), DATE)
FROM STUDENTNOTE B
WHERE B.STUDENTID = T1.STUDENTID
FOR XML PATH('')), 1, 1, '') [NOTE]
FROM STUDENTNOTE T1
GROUP BY T1.STUDENTID