mysql将逗号隔开的字符串转换为表数据

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhaozhirongfree1111/article/details/78113647

INSERT INTO tmp_split SELECT
a.id,
substring_index(
substring_index(
a.ids,
‘,’,
b.help_topic_id + 1
),
‘,’ ,- 1
)
FROM
test a
JOIN mysql.help_topic b ON b.help_topic_id < (
length(a.ids) - length(REPLACE(a.ids, ‘,’, ”)) + 1
)
ORDER BY
a.ID

猜你喜欢

转载自blog.csdn.net/zhaozhirongfree1111/article/details/78113647