(1)源数据
表:vv
(2)实现:
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(a.`target`,',',b.help_topic_id+1),',',-1) AS 'target'
FROM `vv_csv` a
JOIN mysql.help_topic b
ON b.help_topic_id < (LENGTH(a.`target`) -LENGTH(REPLACE(a.`target`,',',''))+1);
substring_index(截取字段名,分隔符,分隔符出现的次数)
replace(操作替换的列名,'替换符号','替换后值')
help_topic_id为MySQL自带表
(3)结果
target |
a |
b |
c |
d |
e |
f |
a1 |
b2 |
c3 |
d4 |
e5 |
f6 |