Re: Given N, finding the interval of N hours with max(sum(..))

Поиск
Список
Период
Сортировка
От Leonardo F
Тема Re: Given N, finding the interval of N hours with max(sum(..))
Дата
Msg-id 329833.11477.qm@web29008.mail.ird.yahoo.com
обсуждение исходный текст
Ответ на Given N, finding the interval of N hours with max(sum(..))  (stefano bonnin <stefano.bonnin@gmail.com>)
Список pgsql-general
>I'm trying to make a query that, given N and a date, gives me the interval of N hours with the max(sum(...)).

select sum(i) as s, timestamp '2010-06-16 00:00:00' + extract(hour from d)::integer/3*3 * interval '1 hour' as sumd
fromp group by extract(hour from d)::integer/3 where d = '2010-06-16 00:00:00' order by s desc limit 1; 

is this what you're looking for?




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

Предыдущее
От: Mike Christensen
Дата:
Сообщение: Re: [Blatant Alias Abuse] Anyone want to help out with a coding problem?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: oid data types mapping in libpq functions