select distinct
t1.[HSE_READER_ID]+', ' AS [HSE_READER_ID],
stuff((select ',' + [HSE_PRIMARY_COURSE] from [Heri_Student_Courses]
where [HSE_READER_ID] = t1.[HSE_READER_ID] for xml path('')), 1,1,'') as [HSE_PRIMARY_COURSE]
from [Heri_Student_Courses] as t1
|