Re: exclude part of result - Mailing list pgsql-sql

From Marc Mamin
Subject Re: exclude part of result
Date
Msg-id CA896D7906BF224F8A6D74A1B7E54AB3039E8A54@JENMAIL01.ad.intershop.net
Whole thread Raw
In response to Re: exclude part of result  (Harald Fuchs <hari.fuchs@gmail.com>)
List pgsql-sql
Hi,

Two other ideas...

SELECT DISTINCT p.a, p.b, p.c, now(), count(item.item_pk)
FROM product p     JOIN    (select distinct a,b,c from  products     except     select distinct a,b,c from  navigation
 )foo      USING (a,b,c)    LEFT JOIN item ON item.product_fk = product_pk 
WHERE ...
GROUP BY p.a, p.b, p.c


or maybe

SELECT DISTINCT foo.*, now(), count(item.item_pk)
FROM (select distinct a,b,c from  products     WHERE ...     except     select distinct a,b,c from  navigation    )foo
   LEFT JOIN item ON item.product_fk = product_pk 
WHERE ...
GROUP BY p.a, p.b, p.c

HTH,

Marc Mamin


pgsql-sql by date:

Previous
From: Harald Fuchs
Date:
Subject: Re: exclude part of result
Next
From: Tarlika Elisabeth Schmitz
Date:
Subject: Re: exclude part of result