Thread: grouping by date

grouping by date

From
teknokrat
Date:
How can I group by date given a timestamp column?

thanks



Re: grouping by date

From
Robert Creager
Date:
When grilled further on (Mon, 05 Jan 2004 17:14:26 +0000),
teknokrat <teknokrat@yahoo.com> confessed:

> How can I group by date given a timestamp column?
> 

I just found this out this weekend.  Try 'date_trunc'.  Look at secion 9.8.2 of
the documentation.  I'm using something like:

SELECT date_trunc( 'hour', "when" ) AS "date" FROM readings GROUP BY "date";

Where "when" is my timestamp columnn.

Cheers,
Rob

-- 21:55:40 up 11 days, 11:46,  4 users,  load average: 2.09, 2.03, 2.01