From: | Zak McGregor <zak(at)mighty(dot)co(dot)za> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: count(1) return 0? |
Date: | 2004-03-01 02:28:31 |
Message-ID: | 20040301042831.7fd8f4ec.zak@mighty.co.za |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 01 Mar 2004 13:12:12 +1100
Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au> wrote:
> The counting and grouping is done after the where clause is applied.
>
> since player iplaybadly (who was 1200's opponent) didnt win any, he/she
> is not included in the result set to be grouped and counted. You need
> to get iplaybadly into the result set first.
>
> try something like
>
> select fixture, home, sum(case winner=home then 1 else 0 end)
> >from results
> group by fixture, home
Ah, thanks, works a charm.
Thanks too to all who offered help on this one.
Ciao
Zak
--
========================================================================
http://www.carfolio.com/ Searchable database of 10 000+ car specs
========================================================================
From | Date | Subject | |
---|---|---|---|
Next Message | John Wells | 2004-03-01 02:39:40 | elog: out of memory |
Previous Message | Klint Gore | 2004-03-01 02:12:12 | Re: count(1) return 0? |