Sai Reddy

Sai Reddy

  • NA
  • 214
  • 31k

Stuff with XML PATH

May 7 2018 6:02 AM
id Email
 
output:
id email
 
I found the following query some where can you explain it?
 
SELECT id, Email =
STUFF((SELECT ', ' + Email
FROM comma b
WHERE b.id = a.id
FOR XML PATH('')), 1, 1, '')
FROM comma a
GROUP BY id

Answers (1)