user3808307 user3808307 - 6 months ago 18
MySQL Question

How to do a MySQL query with these relational tables

I have the following tables

videos

id | title | url


video_to_category

video_id | category_id


I would like a query to get once all videos from the video table that have a certain category_id

Answer
SELECT * FROM videos v, video_to_category vc
WHERE v.id=vc.video_id AND category_id=YOURID