我有一个包含三列像image(Source)的表,想要编写一个像图像一样的表(Result)
答案 0 :(得分:6)
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