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 | 10:45:00 | 71
1999-12-19 | 11:00:00 | 74
1999-12-19 | 11:15:00 | 78
I can aggregate by the hour without problem:
SELECT Date, date_trunc('hour', Time) AS HOUR, SUM(Data)
FROM Table
GROUP BY Date, HOUR;
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?
Thanks in advance,
-Lars