Thank you Michael, your suggestion works a charm (though I didn't
bother coalescing the two grp because I think the USING takes care of
that anyway.
Paul
On 7/8/05, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
> SELECT coalesce(g.grp, b.grp) AS grp,
> coalesce(g.count, 0) AS countgood,
> coalesce(g.sum, 0) AS sumgood,
> coalesce(b.count, 0) AS countbad,
> coalesce(b.sum, 0) AS sumbad
> FROM
> (SELECT grp, count(good), sum(good) FROM lefty GROUP BY grp) AS g
> FULL OUTER JOIN
> (SELECT grp, count(bad), sum(bad) FROM righty GROUP BY grp) AS b USING (grp);