| From: | Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com> |
|---|---|
| To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: A join of 2 tables with sum(column) > 30 |
| Date: | 2011-03-15 21:49:02 |
| Message-ID: | 66DD1CD5-0836-44D0-9B23-3AFEA83B4733@enterprisedb.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mar 16, 2011, at 3:15 AM, Alexander Farber wrote:
> And same for a simple select-query from1 table (w/o join):
>
> # select id from pref_match where sum(completed) > 30 group by id;
> ERROR: aggregates not allowed in WHERE clause
> LINE 1: select id from pref_match where sum(completed) > 30 group by...
> ^
Use having clause for aggrgate function,
group by col1, col2 having sum(col) >
Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bill Thoen | 2011-03-16 00:36:40 | Re: Partitioned Database and Choosing Subtables |
| Previous Message | Vibhor Kumar | 2011-03-15 21:47:46 | Re: A join of 2 tables with sum(column) > 30 |