SELECT a.*,GROUP_CONCAT(code),GROUP_CONCAT(c.category_name) from (
select a.category_uuid uuid ,substring_index(substring_index(a.category_path,'+',b.AutoIncreID),'+',-1) as code
from
goods_category a
join
incre_table b
on b.AutoIncreID <= (length(a.category_path) - length(replace(a.category_path,'+',''))+1)
where `category_uuid` =1000
) a
LEFT JOIN goods_category c on a.code = c.category_uuid