mysql实现字符串分割(split)功能
时间:2019-11-25 16:42:27
收藏:0
阅读:1518
数据库表bim_section_management中path中存储的值为 a.b.c.d 的字符串形式,以 . 分割,实现查询具体的sql如下:
select
DISTINCT substring_index( substring_index(t1.path,‘.‘,t2.help_topic_id + 1), ‘.‘ ,-1 )
from bim_section_management t1 join mysql.help_topic t2 on t2.help_topic_id < (length(t1.path) - length(REPLACE(t1.path,‘.‘,‘‘)) + 1 )
如果复用只需要替换加粗部分代码即可。
原文:https://www.cnblogs.com/id-tangrenhui/p/11928357.html
评论(0)