Re: Operator performance question

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Operator performance question
Дата
Msg-id 45A4AB70.9090103@magproductions.nl
обсуждение исходный текст
Ответ на Re: Operator performance question  ("Brandon Aiken" <BAiken@winemantech.com>)
Список pgsql-general
Brandon Aiken wrote:
> Shouldn't these be using HAVING?
>
> SELECT COUNT(max_persons) ...
> GROUP BY NULL
> HAVING max_persons >= 5 AND max_persons <= 8;

I don't think so; I need multiple COUNT results for multiple
combinations; 5-8 persons isn't the only one. I also need counts for
1-4, 9-12 and 13 and up.

The output I currently get is something like this:
"persons 1-4"    | 123
"persons 5-8"    | 234
"persons 9-12"    | 345
...
"LOCATION_NETHERLANDS"    | 987
"LOCATION_BELGIUM"    | 765
...
"washing machine"    | 432
"dish washer"        | 210

I don't see how I would get that with a HAVING clause. And I don't think
you can have multiple HAVING clauses...

The crux of the query is that I get all kinds of conditions counted -
with a single query, output as a single record.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

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

Предыдущее
От: "Andy Dale"
Дата:
Сообщение: Re: Discovering time of last database write
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Operator performance question