Saturday, June 28, 2014

how to concat multiple rows with same id in sql

Hello,


Try to use below query.



SELECT STUFF
(
(SELECT ',' + CONVERT(VARCHAR(10),Id)
FROM [TableName]
WHERE Id=''
FOR XML PATH(''))
, 1, 1, '')





No comments:

Post a Comment