Re: A join of 2 tables with sum(column) > 30 - Mailing list pgsql-general

From Vibhor Kumar
Subject Re: A join of 2 tables with sum(column) > 30
Date
Msg-id 66DD1CD5-0836-44D0-9B23-3AFEA83B4733@enterprisedb.com
Whole thread Raw
In response to Re: A join of 2 tables with sum(column) > 30  (Alexander Farber <alexander.farber@gmail.com>)
List 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.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com


pgsql-general by date:

Previous
From: Vibhor Kumar
Date:
Subject: Re: A join of 2 tables with sum(column) > 30
Next
From: Bill Thoen
Date:
Subject: Re: Partitioned Database and Choosing Subtables