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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to