I have an SQL Server script that concatenates multiple row based on unique ID. I need to be able to combine them into 1 row to avoid showing multiple lines for the same unique ID. The code below is not working. Please advise. Thanks.
Line of code
select
STUFF((
SELECT DISTINCT ', ' + CAST(Transcript AS VARCHAR(max)) [text()]
FROM MyTableName
FOR XML PATH(''), TYPE)
.value('.','VARCHAR(MAX)'),1,2,'') Transcript_Combined from #Transcripts