Re: Full outer join question. - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Full outer join question.
Date
Msg-id 200507081329.51223.peter_e@gmx.net
Whole thread Raw
In response to Full outer join question.  (Paul McGarry <paul.mcgarry@gmail.com>)
List pgsql-general
Am Freitag, 8. Juli 2005 03:22 schrieb Paul McGarry:
> When I do that I lose all the rows whose grp isn't in both tables. For
> example: ======
> SELECT grp, count(goodamount), sum(goodamount), count(badamount),
> sum(badamount) FROM lefty FULL OUTER JOIN righty USING (grp)
> WHERE lefty.day >= '2005-06-01' AND righty.day>='2005-06-01'
> GROUP BY grp;

You need to write ... WHERE (lefty.day >= '2005-06-01' OR lefty.day IS NULL)
AND etc.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-general by date:

Previous
From: Klint Gore
Date:
Subject: mail change for list?
Next
From: "David Esposito"
Date:
Subject: Re: index bloat