Semoga ini membantu. Anda dapat berkomentar ORDER BY T1.Str_Value
jika tidak diperlukan dan atur ukuran nvarchar(500) sesuai kebutuhan
SELECT DISTINCT T1.UserId,
Stuff(
(SELECT N', ' + T2.Str_Value
FROM t T2
WHERE T2.userId = T1.userid
ORDER BY T2.Str_Value
FOR XML PATH(''),TYPE).value('text()[1]','nvarchar(500)'),1,2,N'')
AS Str_Value
FROM t T1