I have three tables:
Photos:
- photo_id
- photo_name
Photo_to_category
- id
- photo_id
- category_id
Category
- category_id
- category_name
I would like show all photo with category. One photo can have eg.. 5 category. Someone can get me a full SQL request? I try with LEFT JOIN but it not working too well. Maybe GROUP()?? Thanks
// MY CODE
SELECT * FROM photos AS p
LEFT JOIN photo_to_category AS ptc ON p.photo_id = ptc.photo_id
LEFT JOIN category AS c ON ptc.category_id = c.category_id