Re: Full outer join question.

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org, paul(at)paulmcgarry(dot)com
Subject: Re: Full outer join question.
Date: 2005-07-08 11:29:50
Message-ID: 200507081329.51223.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Esposito 2005-07-08 12:01:54 Re: index bloat
Previous Message Klint Gore 2005-07-08 04:23:45 mail change for list?