Suppose that I have a table called exam. Each row contains:
examDate
userId
passed
So, we might have the following results:
Jan 1 2010, 7, false
Jan 2 2010, 8, true
Jan 3 2010, 7, true
Jan 3 2010, 9, false
I want to run a report which includes all users who have NEVER passed the exam. In the above example, only userId 9 should be returned by this query.
I do not want to do something really inefficient like:
Select * from exam where passed = 'false' and userId Not In
(Select userId from exam where passed = 'true');