View Single Post

   
  #1 (permalink)  
Old 04-19-2008, 07:00 PM
ChronoFish
 
Posts: n/a
Default Opposite of "not in"

Hello,

A common query that I have is to see if a member of a table is in a
list. Simple enough:

SELECT * FROM drivers WHERE driver_id IN (123, 456, 789)

Or not in the list:

SELECT * FROM drivers WHERE driver_id NOT IN (123, 456, 789)



However sometimes I want to know which members of the list are not in
the table. My pseudo SQL looks like this:

SELECT * FROM (123, 456, 789) WHERE NOT IN drivers

What's the easiest way to write this in SQL (using Postgres 7.3)?

Thanks,
CF
Reply With Quote