Consider we have table like this
id name
1 Yesy
2 Yesy
expected result to concatenate the values of a name column in all rows into one row
Solution:
select
DECLARE
SET @title_ids varchar(max), @delimiter char @delimiter = ','SELECT @title_ids = COALESCE(@title_ids + @delimiter, '') + name FROM test4SELECT @title_ids AS [List of Title IDs] * from test4
No comments:
Post a Comment