[Solved] Getting Data separated by comma, [duplicate]


Like here, here or here.

SELECT 
  [TicketId],
  STUFF((
    SELECT ', ' + [Name]) 
    FROM [OneTable] 
    WHERE ([TicketId] = OT.[TicketId]) 
    FOR XML PATH(''),TYPE).value('(./text())[1]','VARCHAR(MAX)')
  ,1,2,'') AS Name
FROM [OneTable] OT
GROUP BY [TicketId]

Go and vote it up, then close this question.

1

solved Getting Data separated by comma, [duplicate]