I have table place contains author_id and table place_user_relation contains columns user_id,place_id
I want to fetch `place.id` where `place_user_relation.user_id=1` or `place.author_id=1`.Problem is this criteria is in two tables. To my knowledge, I wrote a wrong query:
SELECT r.*,p.* FROM place_user_relation as r
JOIN place as p
ON p.place_id=r.place OR p.author_id=1
WHERE r.user_id=1
/*I also tried WHERE r.user_id=1 OR p.author_id=1*/
in which contains an OR in ON statement, seems I can’t do that. What’s the right way to do this?
Try this: