mysql将一行变成多行的方法:
把

转成

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)图A转成图B

图a

图b
SELECT
substring_index(substring_index( a.rn,',',b.help_topic_id + 1 ), ',' ,- 1 ) AS rn
FROM
(select SUBSTR(GROUP_CONCAT( REPEAT(CONCAT(number,','),fre) SEPARATOR ''),1,LENGTH(GROUP_CONCAT( REPEAT(CONCAT(number,','),fre) SEPARATOR ''))-1) as rn from numbers ) a
JOIN mysql.help_topic b ON b.help_topic_id <
(length(a.rn) - length( replace(a.rn, ',', '') ) + 1) 