difference between EXCEPT and NOT IN?

From: "Raphael Bauduin" <rblists(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: difference between EXCEPT and NOT IN?
Date: 2008-04-01 15:50:42
Message-ID: f5227160804010850q74063e22t644ea4274c67730d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

The 2 following statements don't give the same result. I expected the
second ti give the exact same result as the first one.
What am I missing?

development=> SELECT id FROM entrees except select entree_id from
postes ORDER BY id desc;
id
------
3651
(1 row)
development=> SELECT id FROM entrees WHERE id not in (select
entree_id from postes) ORDER BY id desc;
id
----
(0 rows)

thanks in advance for the help.

Raph
--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2008-04-01 16:04:22 Re: difference between EXCEPT and NOT IN?
Previous Message Tom Lane 2008-04-01 04:45:36 Re: specifying wal file size