SELECT DISTINCT Name, STUFF((SELECT ',' + Course FROM Student WHERE Name = T.Name FOR XML PATH('')), 1, 1, '') AS Course FROM Student AS T
SQL 将一列多行数据合并为一行
最新推荐文章于 2024-03-23 12:02:12 发布
SELECT DISTINCT Name, STUFF((SELECT ',' + Course FROM Student WHERE Name = T.Name FOR XML PATH('')), 1, 1, '') AS Course FROM Student AS T