Re: Join 2 aggregate queries?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Zak McGregor <zak(at)mighty(dot)co(dot)za>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Join 2 aggregate queries?
Date: 2004-02-13 01:48:35
Message-ID: 20040213014835.GB22135@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 13, 2004 at 02:13:11 +0200,
Zak McGregor <zak(at)mighty(dot)co(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Cott Lang 2004-02-13 02:06:42 Re: pg_dump/pg_restore problems with 7.4.1
Previous Message Jason Tesser 2004-02-13 00:22:24 Re: help with query speed