Re: How to GROUP results BY month

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: How to GROUP results BY month
Дата
Msg-id 487C9A9A.1040107@unicell.co.il
обсуждение исходный текст
Ответ на How to GROUP results BY month  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
Список pgsql-sql
Oliveiros Cristina wrote:

> Howdy, all,
>
> I have a problem.
>
> I have a table which one of the fields is of type date.
>
> I need to obtain the totals of the other fields in a  by-month basis
> IS there any easy way to do this using the GROUP BY or any other 
> construct?
Yes, use date_trunc( 'month', time_stamp ).

Example:

select count(*),date_trunc( 'month', time_stamp ) from rb group by
date_trunc( 'month', time_stamp );



Herouth



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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: How to GROUP results BY month
Следующее
От: Herouth Maoz
Дата:
Сообщение: Re: How to GROUP results BY month