Ratings, Users, and reviews.
The Ratings table has a users FK. The Reviews table has a rating FK. Not all ratings have a review.
Ratings
ratingid
rating_hid
rating_uid
users
userid
user_name
Reviews
reviewid
review_ratingid
I want to get all the ratings where "hid" =1. I also want to get the user info from users for that rating.
Code: Select all
SELECT *
FROM rating, users
WHERE rating.rating_hid =1 AND rating.rating_uid = users.useridBut now I want to get the review that is being pointed to in Ratings, if there is one., but can't figure it out.
Code: Select all
SELECT *
FROM rating, users, reviews
WHERE rating.rating_hid =1 AND rating.rating_uid = users.userid AND reviews.review_ratingid = rating.ratingidThanks,
Mike