利用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
查看更多关于mysql 切割字符串,实现一行变多行的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did117832