tricky date manipulations?

Started by Alfred Perlsteinabout 26 years ago2 messagesgeneral
Jump to latest
#1Alfred Perlstein
bright@wintelcom.net

I'm trying to accomplish some things where some tricky manipulation
of dates would be very helpful.

I'm wondering if it's possible to:

select from a table several records and group by a date column.

The idea is that I have a table with rows for each hour, I'd like
to be able to select a date range (let's say a month) and perform
sums on some of the columns however "group by" the day, so that I
get rows returned that are the sum of all the day's statistics for
several days.

--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

#2Frank Bax
fbax@execulink.com
In reply to: Alfred Perlstein (#1)
Re: tricky date manipulations?

At 05:35 PM 4/06/00 -0700, you wrote:

select from a table several records and group by a date column.

just cast your datetime or timestamp (hour) field into a date...

select hour::date, sum(whatever) from table group by hour::date;

Frank