Search Postgresql Archives

Re: Full outer join question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux