Re: How to GROUP results BY month - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: How to GROUP results BY month
Date
Msg-id 487C9A9A.1040107@unicell.co.il
Whole thread Raw
In response to How to GROUP results BY month  ("Oliveiros Cristina" <oliveiros.cristina@marktest.pt>)
List 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 by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: How to GROUP results BY month
Next
From: Herouth Maoz
Date:
Subject: Re: How to GROUP results BY month