Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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;
Source by dba.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #comma #seperated #join #mssql
ADD COMMENT
Topic
Name
4+2 =