mysql拆分逗号一列变多行

需求:

 

SELECT 
DISTINCT substring_index(substring_index(a.value, ',', b.help_topic_id + 1), ',', - 1)
FROM TABLE a
INNER JOIN mysql.help_topic b
    ON b.help_topic_id < (length(a.value) - length(replace(a.value, ',', '')) + 1)

 

posted @ 2019-08-13 12:36  郭大侠1  阅读(1717)  评论(0编辑  收藏  举报