Re: [GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Lars
It may be ugly, but it sure works! Here is my query: SELECT Date, interval(trunc(date_part('epoch', time)/1800) * 1800) AS HALFHOUR, SUM(Data) FROM Table GROUP BY Date, HALFHOUR; This seems to work great, and I don't see any performance hit either. Thanks, -Lars On Thu, 20 Jul 2000, Tom Lane w

Re: [GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Thomas Lockhart
> In the long run it seems like date_trunc ought to be more flexible > than it is... Now that we can easily overload built-in functions, we should be able to have an alternate form for date_trunc() which can do this. Say, by accepting a double value as the first argument, which would be the amoun

Re: [GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Tom Lane
Lars <[EMAIL PROTECTED]> writes: > What I would like to do though is aggregate by each half hour or maybe > even 20 minutes. Does anyone know a good way to do this? I don't have a *good* answer, but a brute-force way is * convert timestamp to integer seconds with date_part('epoch', foo) * round

[GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Lars
I am looking for a way to aggregate timestamped data on a half hour interval, not just by the hour or minute. Suppose I have a table composed of: Date | Time | Data ---+--+-- 1999-12-19 | 10:00:00 | 76 1999-12-19 | 10:15:00 | 72 1999-12-19 | 10:30:00 | 77 1999-12-19