常用SQL笔记MySQL
2025-04-08 23:43阅读:43评论:0
MySQL逗号分割字段的列转行
1
2
3
4
5
6
7
8
9
10
select a.id,substring_index(substring_index(a.val,',',b.help_topic_id+1),',',-1)from tbl_brand_attr_group ajoinmysql.help_topic bon b.help_topic_id < (length(a.val) - length(replace(a.val,',',''))+1)# 测试单条and a.id='e0e00b82-e148-4918-8e5d-f167a5a8006d'order by a.id;