| From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
|---|---|
| To: | Brandon Aiken <BAiken(at)winemantech(dot)com> |
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Operator performance question |
| Date: | 2007-01-10 09:01:36 |
| Message-ID: | 45A4AB70.9090103@magproductions.nl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)magproductions(dot)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 //
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alban Hertroys | 2007-01-10 09:22:28 | Re: Operator performance question |
| Previous Message | Andy Dale | 2007-01-10 08:33:13 | Re: Discovering time of last database write |