sql
select
product.id as proruct_id,
product.name as product_name,
tag.id as tag_id,
tag.name as tag_name
from product
left join
map_product_tag
on
product.id = map_product_tag.product_id
left join tag on map_product_tag.tag_id = mst_tag.id;
この場合のqueryの書き方結果は
+--------------------------------------+--------------+--------------------------------------+------------------+
| proruct_id | product_name | tag_id | tag_name |
+--------------------------------------+--------------+--------------------------------------+------------------+
| 1 | hoge | 11 | tag1 |
| 1 | fuga | 22 | tag2 |
+--------------------------------------+--------------+--------------------------------------+------------------+
となります。
product_idが同じ場合、tag_idをご教授いただき"11,22"のように1行で取得したいです。.