select distinct substring_index( substring_index( a.需要拆分的字段名, ',', b.help_topic_id + 1 ), ',',- 1 ) name
from 表名 a
join mysql.help_topic b ON b.help_topic_id < ( length( a.需要拆分的字段名 ) - length( replace( a.需要拆分的字段名, ',', '' ) ) + 1 )
where a.tt_id =1
substring_index() (mysql 拆分函数)
mysql.help_topic (mysql 默认自增序列表)
本文介绍了一种使用MySQL内置函数substring_index()结合help_topic表进行字段拆分的方法,适用于需要从逗号分隔的字符串中提取特定部分的场景。通过join操作与substring_index函数的应用,实现了对指定字段的有效拆分。
2900

被折叠的 条评论
为什么被折叠?



