MySQL 将字符串根据逗号分隔,拆分为多条记录

不点 阅读:815 2021-03-31 16:52:37 评论:0

select substring_index(substring_index(a.unit_proj_type,',', b.help_topic_id + 1), ',', -1) as unit_proj_type  from ucas_unit_proj a 
	JOIN mysql.help_topic b  
	ON b.help_topic_id < (LENGTH(a.unit_proj_type) - LENGTH(REPLACE(a.unit_proj_type, ',', '')) + 1 ) 
	where a.unit_proj_type is not null

标签:mysql
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号