From: T E Schmitz <mailreg@numerixtechnology.de>
To: pgsql-sql@postgresql.org
Subject: replace EXCEPT by JOIN
Date: Thu, 12 Apr 2007 19:32:10 +0100
Message-ID: <461E7B2A.6040507@numerixtechnology.de> (raw)
The following construct does what I need but is there a better way of
expressing this?
select * from
(
SELECT DISTINCT
section.section_pk
FROM ITEM
LEFT JOIN product product ON Item.product_fk = product.product_pk
LEFT JOIN section section ON product.section_fk = section.section_pk
WHERE item.export = 'f'
EXCEPT
SELECT DISTINCT
section.section_pk
FROM ITEM
LEFT JOIN product product ON Item.product_fk = product.product_pk
LEFT JOIN section section ON product.section_fk = section.section_pk
WHERE item.export = 't'
) as X
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: mailreg@numerixtechnology.de
Subject: Re: replace EXCEPT by JOIN
In-Reply-To: <461E7B2A.6040507@numerixtechnology.de>
* 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