SQL to concatenate column values from multiple rows

 

SELECT DISTINCT L2.Issue, substring(
 (SELECT ',' + L1.Label AS [text()]
 FROM jira.label L1
 WHERE L1.Issue = L2.Issue
 ORDER BY L1.Issue
 FOR XML PATH (''))
 ,2
 ,1000) [Labels]

March 27, 2013 В· admin В· No Comments
Posted in: MSSQL, Tech

Leave a Reply