SELECT
t3.str,
GROUP_CONCAT( t3.str_1 ) AS str_2
FROM
(
SELECT
t1.str,
substr( t1.str, t2.help_topic_id + 1, 1 ) AS str_1,
t2.help_topic_id
FROM
( SELECT 'abc' AS str UNION ALL SELECT 'bcd' AS str ) t1
JOIN mysql.help_topic t2 ON t2.help_topic_id < length( t1.str )
) t3
GROUP BY
t3.str
其中help_topic是MySQL库的自增表,如果自己有自增表也是一样的。
这里的思路是先拆成多行,再合并。