How do I get:
id Name Value 1 A 4 1 B 8 2 C 9
to
id
Let's get very simple:
SELECT stuff( ( select ', ' + x from (SELECT 'xxx' x union select 'yyyy') tb FOR XML PATH('') ) , 1, 2, '')
Replace this line:
select ', ' + x from (SELECT 'xxx' x union select 'yyyy') tb
With your query.