| From: | Frans <fransgunawan(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Aggregates not allowed in WHERE clause? |
| Date: | 2004-12-16 05:02:34 |
| Message-ID: | e07d6ffa04121521025101d985@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ron Peterson | 2004-12-16 05:17:47 | Re: bytea internal encoding |
| Previous Message | Ron Peterson | 2004-12-16 04:08:29 | bytea internal encoding |