首页 > 数据库技术 > 详细

mysql实现字符串分割(split)功能

时间:2019-11-25 16:42:27      阅读:1519      评论:0      收藏:0      [点我收藏+]

 

数据库表bim_section_managementpath中存储的值为 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 )

如果复用只需要替换加粗部分代码即可。

mysql实现字符串分割(split)功能

原文:https://www.cnblogs.com/id-tangrenhui/p/11928357.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!