I can’t seem to get the join / query that I need!
Lets say I have 3 tables (trimmed for this post…)
user_courses
(int) user_id
(int) course_id
users
(int) user_id
(txt) name
(txt) access
courses
(int) course_id
(txt) course_desc
What I am trying to do is select select all users with a certain access type that are taking a specific course (course_id)
something like…
SELECT *
FROM user_courses uc
JOIN users u
ON uc.user_id = u.user_id
JOIN courses c
ON uc.course_id = c.course_id
WHERE u.access = "foobar"
… but working like I want it to 🙂
I can get close, but will have extra users that don’t have the correct access type.
Use
inner join.