Answers for "sql get values of a join as a comma separated list in column"

SQL
0

comma seperated join mssql

select SM.ROLLNO,
       SM.NAME, 
       SM.ADDRESS,
       (
       select ','+CM.CourseName
       from dbo.CourseMaster as CM
       where ','+SM.Course+',' like '%,'+CM.CourseId+',%'
       for xml path(''), type
       ).value('substring(text()[1], 2)', 'varchar(max)') as Course
from dbo.StudentMaster as SM;
Posted by: Guest on November-17-2020

Code answers related to "sql get values of a join as a comma separated list in column"

Code answers related to "SQL"

Browse Popular Code Answers by Language