Re: join/group/count query.

Поиск
Список
Период
Сортировка
От Gary Stainburn
Тема Re: join/group/count query.
Дата
Msg-id 200612210946.56643.gary.stainburn@ringways.co.uk
обсуждение исходный текст
Ответ на Re: join/group/count query.  ("Hector Villarreal" <HVillarreal@mynewplace.com>)
Список pgsql-sql
On Wednesday 20 December 2006 18:06, Hector Villarreal wrote:
> HI in reading this is it possible what was really intended :
> Sum(case when o_model = 5 then 1 else NULL end) as KA
> That would provide a count of all records meeting that condition.
> Otherwise the count( approach will not do that.
>

Because the else is NULL, count does work. Although I would imagine sum will 
also work, count more reflects the logic, i.e. the number of times that 
condition is true
-- 
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


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

Предыдущее
От: "Hector Villarreal"
Дата:
Сообщение: Re: join/group/count query.
Следующее
От: Alexis Paul Bertolini
Дата:
Сообщение: Changing character set when the damage is done