Re: count(1) return 0?

Поиск
Список
Период
Сортировка
От Zak McGregor
Тема Re: count(1) return 0?
Дата
Msg-id 20040301042831.7fd8f4ec.zak@mighty.co.za
обсуждение исходный текст
Ответ на Re: count(1) return 0?  (Klint Gore <kg@kgb.une.edu.au>)
Список pgsql-general
On Mon, 01 Mar 2004 13:12:12 +1100
Klint Gore <kg@kgb.une.edu.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
========================================================================

В списке pgsql-general по дате отправления:

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: A simple question (under pressure :-))....
Следующее
От: John Wells
Дата:
Сообщение: elog: out of memory