Original Post
I'm having trouble putting a query together and i was hoping you might be able to help. For this example, i'm creating a testing/grading scenario. We have students, courses, and tests_taken tables like so: STUDENTS - id - username COURSES - id - course_title TESTS_TAKEN - user_id - course_id - score What i want to do is spit out a table that prints all the available courses in the database (any student can take any course) and the score (if any) the student got on the final test for that course. Each course has only one test. You either pass or fail. If a student has not taken the final exam for the course, there will be no entry in the TESTS_TAKEN table. Courses are sequential. Ideally, i would like to have output like this: [ logged in as "username" ] 85% FOO 101 73% BAR 101 77% HotDogs For Dummies --- Quantum Physics for Dummies --- Advanced Car Washing --- Master Class Chess This shows all the courses available (all 6) and that the logged-in user has completed the final exam on the first 3 courses. I'm looking for the proper SQL query for this. I know i have to use an OUTER JOIN to get the basic data, but i also have to limit the test scores data to the user_id of the logged in user. That's what' tripping me up. Thanks for your help!