From: Raphael Bauduin <rblists@gmail.com>
To: pgsql-sql@postgresql.org
Subject: difference between EXCEPT and NOT IN?
Date: Tue, 1 Apr 2008 17:50:42 +0200
Message-ID: <f5227160804010850q74063e22t644ea4274c67730d@mail.gmail.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rblists@gmail.com
Subject: Re: difference between EXCEPT and NOT IN?
In-Reply-To: <f5227160804010850q74063e22t644ea4274c67730d@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox