Mysql 单列按符号分隔为多条数据
select a.id,substring_index(substring_index(a.name,’,’,b.help_topic_id+1),’,’,-1) name
from test a join
mysql.help_topic b
on b.help_topic_id < (length(a.name) - length(replace(a.name,’,’,’’))+1)
order by a.id;
原链接
##CMD本地导入sql文件
g:
cd mysql\bin
先进入mysql安装目录下的bin目录下
mysql -u root -p 数据库名称< D:\sjk\user.sql 按回车键后输入数据库的密码
这篇博客介绍了如何使用MySQL的substring_index函数将单列中的数据按特定符号分隔成多条记录。通过join操作和help_topic_id进行计算,实现了数据的拆分,并提供了CMD命令来导入SQL文件到数据库。
10万+

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



