利用help_topic表把字符串转换成行(分隔符号',')

 

SELECT substring_index(substring_index('a,b,c,d,e,f,g,h',',',`help_topic_id`+1),',',-1) as `id` FROM mysql.`help_topic`;

 

统计字符串每个子串出现次数(分隔符号',')

 

SELECT substring_index(substring_index(A.`column`,',',B.`help_topic_id` + 1),',',-1) AS `sub_column`,COUNT(A.`column`) AS `count`
FROM `test` A
JOIN mysql.`help_topic` B ON B.`help_topic_id` < (length(A.`column`) - length(replace(A.`column`,',',''))+1)
GROUP BY substring_index(substring_index(A.`column`,',',B.`help_topic_id` + 1),',',-1);

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2022-02-20
猜你喜欢
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案