Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 0F9D22E0055 for ; Tue, 1 Apr 2008 12:51:16 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 79878-06 for ; Tue, 1 Apr 2008 12:50:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.189]) by developer.postgresql.org (Postfix) with ESMTP id 7125D2E002C for ; Tue, 1 Apr 2008 12:50:52 -0300 (ADT) Received: by rn-out-0910.google.com with SMTP id s46so1173460rnb.3 for ; Tue, 01 Apr 2008 08:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=P7LHurXjJY3WmoRNBfDkOWqeYqN8UF1veEn0ZWNUYQs=; b=cHbqPb19iqLsFqZtEfyYVRNlzaDzqe6ynu5cNCjpU57eKs6CjO4xa3asymoUzxbyYBSes5lsJqLxBxKNTh/udVxaopclWTnriyPgNX2ojBZ4XlyjSfS6eXbmb8krTPGObcuxg9lcNQyn2FNp0RjePp3F8sfSu7VN+uKnEsNR9JQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=tYTniO2YKW43XBm6IAJk/ikouJravwayli3Yzh2RyCX7tEIiHgDVmGL3j3WkuGg8Gxmit7hkCJlanqIlSzitkYxxIn1Qs9EKxDHDQq2pwpAKXc9iqHIJA5RkG5bIroM1BsMtjR/3AERItGD8sIKdDZFotoLNdR3TsI9vrx4BK4c= Received: by 10.114.170.1 with SMTP id s1mr12623442wae.133.1207065051420; Tue, 01 Apr 2008 08:50:51 -0700 (PDT) Received: by 10.114.201.13 with HTTP; Tue, 1 Apr 2008 08:50:42 -0700 (PDT) Message-ID: Date: Tue, 1 Apr 2008 17:50:42 +0200 From: "Raphael Bauduin" To: pgsql-sql@postgresql.org Subject: difference between EXCEPT and NOT IN? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200804/2 X-Sequence-Number: 30541 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