字符串转行
Tue 23 September 2025
字符串转行 help_topic GROUP_CONCAT GROUP_CONCAT mysql.help_topic select GROUP_CONCAT(id) as ids from test
4488,4489,4490,4491,4492,4493,4494
SET @ids = '4488,4489,4490,4491,4492,4493,4494';
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(@ids, ',', ht.help_topic_id + 1), ',', -1) as id FROM mysql.help_topic ht WHERE ht.help_topic_id < (LENGTH(@ids) - LENGTH(REPLACE(@ids, ',', '')) + 1);
Category: 编程mysql