时间:2021-07-01 10:21:17 帮助过:65人阅读
利用help_topic表把以逗号分隔的字符串转换成行。
SELECT substring_index(substring_index( a.rn,‘,‘,b.help_topic_id + 1 ),‘,‘ ,- 1) AS rn FROM (select ‘1,2,3,4‘ as rn) a JOIN mysql.help_topic b ON b.help_topic_id < (length(a.rn) - length( replace(a.rn, ‘,‘, ‘‘) ) + 1)
效果如下
详细实现思路可以看下这个https://blog.csdn.net/zhxdick/article/details/105531916
mysql 切割字符串,实现一行变多行
标签:highlight mys sdn length _id blog com bsp png