我需要你的帮助。我有2张桌子。
1.company_classifications
company_name-classifications
Company A-1,2,3
Company B-1,2
2.classifications
id-name
1-Music
2-Technologi
3-Food
我需要查询结果如下:
company_name-classification_name
Company A-Music, Technologi, Food
Company B-Music, Food
答案 0 :(得分:0)
select cc.company_name,group_concat(c.name)
from company_classifications cc
inner join classifications c
on c.id = find_in_set(c.id,cc.classifications)
group by cc.company_name;