How do I get:
id Name Value
1 A 4
1 B 8
2 C 9
to
id
using XML path will not perfectly concatenate as you might expect... it will replace "&" with "&" and will also mess with <" and ">
...maybe a few other things, not sure...but you can try this
I came across a workaround for this... you need to replace:
FOR XML PATH('')
)
with:
FOR XML PATH(''),TYPE
).value('(./text())[1]','VARCHAR(MAX)')
...or NVARCHAR(MAX)
if thats what youre using.
why the hell doesn't SQL
have a concatenate aggregate function? this is a PITA.