I have a table with three column like image (Source) and want to write a query that give a table like image (Result)
SELECT DISTINCT customer, stuff(( SELECT ',' + cast(policy as varchar(10)) FROM table1 b WHERE a.customerid = b.customerid FOR XML path('') ), 1, 1, '') [policies] FROM table1 a
2.1m questions
2.1m answers
60 comments
57.0k users