Aggregates not allowed in WHERE clause? - Mailing list pgsql-general

From Frans
Subject Aggregates not allowed in WHERE clause?
Date
Msg-id e07d6ffa04121521025101d985@mail.gmail.com
Whole thread Raw
Responses Re: Aggregates not allowed in WHERE clause?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Aggregates not allowed in WHERE clause?  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Hi All,

I have a table (table info) with 2 column, column 'name' and column 'quantity'.

name   |  quantity
--------------------------
a         | 5
b         | 3
a         | 3
c         | 4
b         | 6

If I want to sum the sum of all entry in table.

name |  quantity
------------------------
a       | 8
b       | 9
c       | 4

I can use : select name, sum(quantity) from info group by name;

I want to show the sum of all entry that bigger than 5
name |  quantity
------------------------
a       | 8
b       | 9

I try to use : select name, sum(quantity) from info where
sum(quantity)>20 group by name;
This yields the message: 'Aggregates not allowed in WHERE clause'.

Can somebody help me here....

thx,

Frans

pgsql-general by date:

Previous
From: Ron Peterson
Date:
Subject: bytea internal encoding
Next
From: Ron Peterson
Date:
Subject: Re: bytea internal encoding