[prev in list] [next in list] [prev in thread] [next in thread]
List: postgresql-sql
Subject: [SQL] replace EXCEPT by JOIN
From: T E Schmitz <mailreg () numerixtechnology ! de>
Date: 2007-04-12 18:32:10
Message-ID: 461E7B2A.6040507 () numerixtechnology ! de
[Download RAW message or body]
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
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic