これは機能します:
SELECT t1.ID, MemberList = substring((SELECT ( ', ' + Value ) FROM your_table t2 WHERE t1.ID = t2.ID ORDER BY ID, Value FOR XML PATH( '' ) ), 3, 1000 )FROM your_table t1 GROUP BY ID
プレ>
これは機能します:
SELECT t1.ID, MemberList = substring((SELECT ( ', ' + Value ) FROM your_table t2 WHERE t1.ID = t2.ID ORDER BY ID, Value FOR XML PATH( '' ) ), 3, 1000 )FROM your_table t1 GROUP BY ID
プレ>