字符串转行 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);

image

posted @ 2022-09-20 19:44  逢生博客  阅读(57)  评论(0)    收藏  举报