Search Postgresql Archives

Re: Operator performance question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx

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 //


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux