mysql切割字符串分列展示

134 阅读1分钟
select a.ext_id ,substring_index(substring_index(a.dept_ids,',',b.help_topic_id+1),',',-1) 
from  (
    select ext_id, REPLACE(REPLACE(REPLACE(descendant_ext_ids,"\"",""), '[',''), ']', '') as dept_ids 
    from department where parent_ext_id = 1
    ) a
join   
mysql.help_topic b 
on b.help_topic_id < (length(a.dept_ids) - length(replace(a.dept_ids,',',''))+1);