Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

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 + ',%';
 
PREVIOUS NEXT
Tagged: #sql #join #comma #separated #field
ADD COMMENT
Topic
Name
1+8 =