MySQL逗号分割字段的列转行

select a.id,substring_index(substring_index(a.val,',',b.help_topic_id+1),',',-1)
from 
tbl_brand_attr_group a
join
mysql.help_topic b
on b.help_topic_id < (length(a.val) - length(replace(a.val,',',''))+1)
# 测试单条
and a.id='e0e00b82-e148-4918-8e5d-f167a5a8006d'
order by a.id;
posted @ 2025-04-08 23:43  程序员の奇妙冒险  阅读(28)  评论(0)    收藏  举报