Happy Developer Zone is a blog where you will find interesting topics on Sql server Programming (TSQL).It has tricky and shortest queries for your daily use requirements.It will really help developers to increase their knowledge in Sql Server Coding. I hope this blog will help you a lot.
Tuesday, August 28, 2012
Get comma seperated values with help of XML Path
SELECT Column1, SUBSTRING( ( SELECT ( ', ' + Column2) FROM #test1 t2 WHERE t1.Column1 = t2.Column1 ORDER BY t1.Column1, t2.Column1 FOR XML PATH('') ), 3, 1000) FROM #test1 t1 GROUP BY Column1
No comments:
Post a Comment