Re: Count rows group by time intervals

Поиск
Список
Период
Сортировка
От Kevin Hunter
Тема Re: Count rows group by time intervals
Дата
Msg-id 58BD097B-42B3-49D4-96DA-D7805F077C91@earlham.edu
обсуждение исходный текст
Ответ на Count rows group by time intervals  ("Loredana Curugiu" <loredana.curugiu@gmail.com>)
Список pgsql-novice
At 8:07a -0400 on 09 May 2007, Loredana Curugiu wrote:
> I have the following table:
>
> theme |   receiver        |           date
> ---------+----------------------+------------------------
>  LIA   | +40741775622 |  2007-04-27 00:00:00+00
>  LIA   | +40741775622 |  2007-04-25 00:00:00+00
>  MIA   | +40741775622 | 2007-04-27 00:00:00+00
>  MIA   | +40741775622 |  2007-05-09 00:00:00+00
>
> I would like to count rows group by theme, receiver, and time
> intervals of
> two days. I don't know how to start.

Should get you started:

SELECT
    COUNT( * ),
    theme,
    receiver,
    date
FROM
    yourTable
GROUP BY
    theme,
    receiver,
    date
;

Kevin

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

Предыдущее
От: "Loredana Curugiu"
Дата:
Сообщение: Count rows group by time intervals
Следующее
От: "Oliveiros Cristina"
Дата:
Сообщение: Re: Count rows group by time intervals