WHERE of an AGGREGATE ...

Поиск
Список
Период
Сортировка
От The Hermit Hacker
Тема WHERE of an AGGREGATE ...
Дата
Msg-id 20030614202831.U27289@hub.org
обсуждение исходный текст
Ответы Re: WHERE of an AGGREGATE ...  (deststar <deststar@blueyonder.co.uk>)
Список pgsql-sql
I have a query that looks like:
 SELECT SUM(bytes) AS traffic   FROM traffic_table
GROUP BY ip;

I want to narrow that SELECT down to a subset, like:
  SELECT SUM(bytes) AS traffic    FROM traffic_table   WHERE traffic < ( 100 * 1024 * 1024 )GROUP BY ip;

which, of course, won't work, cause I need to do the GROUP BY before I do
the WHERE ... but there has to be a way of coding that so that it does
work :(

I'm overlooking something obvious here ... I think?

Thanks ...

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org


В списке pgsql-sql по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: How to make a IN without a table... ?
Следующее
От: deststar
Дата:
Сообщение: Re: WHERE of an AGGREGATE ...