Join table with comma delimited field
I've got an issue trying to join tables. Here's an example.
ID CategoryID Title
1 ,1,2,3, Example Title
I need the results to look like so....
Main.ID Category Title
1 Ohio,Texas,Arizona Example Title
I've tried the query below and sometimes it looks correct and other times it doesn't. Even when the categories are the same in the main table.
select a.id, group_concat(category_name) category, title
from tableA a
JOIN category c ON FIND_IN_SET(c.id, a.category_id) <> 0
group by category_id, a.id, title
order by a.id
Is there anyway of parsing this to always get the results in the correct format?