1. 程式人生 > >mysql 按欄位分隔符分成多行

mysql 按欄位分隔符分成多行

SELECT a.id,SUBSTRING_INDEX(SUBSTRING_INDEX(a.continuity_classid,',',b.help_topic_id+1),',',-1) xubaoid
FROM (SELECT * FROM classes_base WHERE continuity_classid !='') a LEFT JOIN mysql.help_topic b 
ON b.help_topic_id < (LENGTH(a.continuity_classid)-LENGTH(REPLACE(a.continuity_classid,',',''))+1 )