How MySql Join two tables with Checkboxes results stored as "string" data format? Suppose I have 2 tables obtained from a web form submission, with some checkboxes results stored as &quot;string&quot; format as describerd here in &quot;hobby&quot; column https://dbfiddle.uk/?rdbms=mysql_5.7&amp;fiddle=aff4e50085be40930e223b00a1ac81f3,
How could I join this two tables and obtain the following result?




sub_id
datimkt




1
Basket,Gas,SUV


2
Basket,Cabrio,Football,hybrid




I've tried to execute the following query, but it only takes the first result from the checkbox result field.
SELECT GROUP_CONCAT(DISTINCT submission_id)sub_id,
GROUP_CONCAT(DISTINCT c1.option_name)datimkt
FROM form_results d
JOIN field_options c1 ON FIND_IN_SET(c1.option_value, d.datimkt)
GROUP BY d.datimkt;
SELECT*FROM result2;
You need to group by the submission_id:
like:
SELECT submission_id sub_id,
GROUP_CONCAT(DISTINCT c1.option_name)datimkt
FROM form_results d
JOIN field_options c1 ON FIND_IN_SET(c1.option_value, d.datimkt)
GROUP BY sub_id;