mysql把一行变成多行的方法:1。将一行变成多行的代码是[substring _ index (a.rn,",",b.help _ topic _ ID 1),",",-1)];2.将多列变成多行。
Mysql将一行变成多行的方法:
(资料图)
保持
变成
挑选
substring _ index(substring _ index(a . rn,",",b.help_topic_id 1),",",- 1) AS rn
从
(选择“1,2,3,4”作为rn) a
JOIN MySQL . help _ topic b ON b . help _ topic _ id
(长度(a. rn)-长度(替换(A . rn,","," "))1)将图A变成图b
图a
图二
挑选
substring _ index(substring _ index(a . rn,",",b.help_topic_id 1),",",- 1 ) AS rn
从
(从数字a中选择SUBSTR(GROUP _ CONCAT(REPEAT(CONCAT(number,",fre) SEPARATOR " "))、1、LENGTH(GROUP _ CONCAT(REPEAT(CONCAT(number,",fre)SEPARATOR " ")))-1)作为rn)
JOIN MySQL . help _ topic b ON b . help _ topic _ id
(length(a . rn)-length(replace(a . rn,","," "))1)更多相关免费学习推荐:mysql教程(视频)
这就是mysql如何把一行变成多行的细节!
来源:php中文网站
标签: