Answers for "how to use comma separator in sql query join selected"

SQL
0

sql join on comma separated field

SELECT * FROM `TABLE1`
JOIN `TABLE2` ON `TABLE1`.`id` = `TABLE2`.`COMMA_SEPERATED_COLUMN` 
AND `TABLE2`.`COMMA_SEPERATED_COLUMN` REGEXP "(^|,)SPECIFIC_ID(,|$)"

############## OR #######################

SELECT * FROM table1 
LEFT JOIN table2 ast ON ast.nodeid = c_NodeId 
AND ',' + ast.GroupNames + ',' LIKE '%,' + table1.GroupAlphabet + ',%';
Posted by: Guest on January-11-2021
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 "how to use comma separator in sql query join selected"

Code answers related to "SQL"

Browse Popular Code Answers by Language