MySQL数据库中字段含逗号的数据,分隔成多条数据


sql语句:

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;

 

结果:

 

转载:https://blog.csdn.net/qq_34542964/article/details/72821764


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM