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

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

发布了1266 篇原创文章 · 获赞 275 · 访问量 290万+

猜你喜欢

转载自blog.csdn.net/zhouzhiwengang/article/details/103809269