Re: Join 2 aggregate queries? - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Join 2 aggregate queries?
Date
Msg-id 20040213014835.GB22135@wolff.to
Whole thread Raw
In response to Join 2 aggregate queries?  (Zak McGregor <zak@mighty.co.za>)
List pgsql-general
On Fri, Feb 13, 2004 at 02:13:11 +0200,
  Zak McGregor <zak@mighty.co.za> wrote:
>
> I'd like to join them somehow to get the following:
>
>  fixtureid | home_team | count1 |  away_team  | count2
> -----------+-----------+--------+-------------+-------
>       2872 | Kat Fish  |    12  | A Cut Above |    13
>       2944 | The Fowls |    11  | Kat Fish    |    14
>
>
>
> Can anyone spot a reasonable way to do that please?

The simplest way given what you've got already is to make each of the
two selects a from item and join them on fixtureid.
That probably isn't the most efficient way to do it, but should get you
going for now.

pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: help with query speed
Next
From: Cott Lang
Date:
Subject: Re: pg_dump/pg_restore problems with 7.4.1