I am stucking with this case, it's about join two tables and return multi record.
Let's assume that i have two tables like this:
Table product:
+----+-----------+-----------+
| id |    name   | media_id  |
+----+-----------+-----------+
| 1  + product 1 +  32,33,34 +
+----+-----------+-----------+
media_id( VARCHAR(50) )
Table media:
+----+-----------+------------------------------------------+
| id |    name   |                  path                    +
+----+-----------+------------------------------------------+
| 31 + media 1   +     localhost://uploads/image/image_1    +
+----+-----------+------------------------------------------+
| 32 + media 2   +     localhost://uploads/image/image_2    +
+----+-----------+------------------------------------------+
| 33 + media 3   +     localhost://uploads/image/image_3    +
+----+-----------+------------------------------------------+
| 34 + media 4   +     localhost://uploads/image/image_4    +
+----+-----------+------------------------------------------+
I tried to use JOIN with WHERE IN clause:
SELECT 
m.id,
m.name as media_name,
p.name,
p.media_id
FROM 
media as m
JOIN product as p
on m.id in (p.media_id);
and other JOIN clause but the return result is:
+----+-----------+-----------+------------+-------------------------+
| id |    name   | image_id  | media_name +          path           + 
+----+-----------+-----------+------------+-------------------------+
| 1  + product 1 +  32,33,34 +  media 2   +   uploads/image/image_1 +
+----+-----------+-----------+------------+-------------------------+
What i want is the return result have 3 records like this:
+----+-----------+-----------+------------+-----------------------+
| id |    name   | image_id  | media_name +          path         +
+----+-----------+-----------+------------+-----------------------+
| 1  + product 1 +     32    +  media 2   + uploads/image/image_2 +
+----+-----------+-----------+------------+-----------------------+
| 2  + product 1 +     33    +  media 3   + uploads/image/image_3 +
+----+-----------+-----------+------------+-----------------------+
| 3  + product 1 +     34    +  media 4   + uploads/image/image_4 +
+----+-----------+-----------+------------+-----------------------+
Does anyone know how to join table like this?
 
    