Aggregates not allowed in WHERE clause?

Поиск
Список
Период
Сортировка
От Frans
Тема Aggregates not allowed in WHERE clause?
Дата
Msg-id e07d6ffa04121521025101d985@mail.gmail.com
обсуждение исходный текст
Ответы Re: Aggregates not allowed in WHERE clause?
Re: Aggregates not allowed in WHERE clause?
Список 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 по дате отправления:

Предыдущее
От: Ron Peterson
Дата:
Сообщение: bytea internal encoding
Следующее
От: Ron Peterson
Дата:
Сообщение: Re: bytea internal encoding