I am working on a query that will collect data from a table and display the data for a report.
The data looks like this:
Player Score
001 10
001
Previous accepted answer is superseded in SQL 2017 and up by STRING_AGG:
SELECT Player, STRING_AGG(Score,', ') FROM YourTable GROUP BY Player
No need to use awkward FOR XML syntax.
I ran this and the accepted answer side-by-side on 100K rows. Accepted answer took 90 seconds, the STRING_AGG version takes less than 1 second.