mysql 效果類似split函式

20211103發表於2024-07-25

SELECT attachment FROM hljtxeip_draft_notice


select a.ID,substring_index(substring_index(a.attachment,',',b.help_topic_id+1),',',-1)
from
hljtxeip_draft_notice a
join
mysql.help_topic b
on b.help_topic_id < (length(a.attachment) - length(replace(a.attachment,',',''))+1)
where substring_index(substring_index(a.attachment,',',b.help_topic_id+1),',',-1) != ''
order by a.ID;

相關文章