Finding the problems a student didn't do

How do I find the problems that the student didn’t do? i.e. the rows problem rows that (for this particular student) doesn’t have a matching row in personproblem.

My (wrong) idea was:

SELECT problem.id, problem.name 
FROM problem 
LEFT OUTER JOIN personproblem ON personproblem.problem = problem.id 
WHERE personproblem.id IS NULL 
 AND (personproblem.person = " . $studentid . " OR personproblem.person IS NULL)

My problem is that if another student have made this problem, it will not show up.

you were so close :slight_smile:

SELECT problem.id
     , problem.name 
  FROM problem 
LEFT OUTER 
  JOIN personproblem 
    ON personproblem.problem = problem.id 
   AND personproblem.person = " . $studentid . " 
 WHERE personproblem.id IS NULL 

Thanks, that helped!