I have 3 tables.
images - image_id .. etc
users - user_id .. etc
favs - user_id, image_id
So now I want when user log into his account and click on button My favs to show all his favs. What would be the query to mysql here?
I have 3 tables.
images - image_id .. etc
users - user_id .. etc
favs - user_id, image_id
So now I want when user log into his account and click on button My favs to show all his favs. What would be the query to mysql here?
 
    
    select images.image_id, ... from images
inner join favs on images.image_id = favs.image_id
inner join users on users.user_id = favs.user_id
where users.user_id = [...]
If you don't need any data from users then the last join is not necessary and you can change the last line to where favs.user_id = [...]
