I'm working in a TimescaleDB in PostgreSQL. I have the following table:
| id | timestamp |
----------------------------
| 1 | 2021-07-12 01:04:58 |
| 2 | 2021-07-12 02:12:03 |
| 3 | 2021-07-12 04:44:11 |
| 4 | 2021-07-12 05:08:31 |
Can I select the time in one hour buckets with timestamp as timestamp_start and timestamp plus one hour as timestamp_end, in one query (meaning no sub query)?
So this is the result I'm looking for:
| timestamp_start | timestamp_end |
---------------------------------------------
| 2021-07-12 01:00:00 | 2021-07-12 02:00:00 |
| 2021-07-12 02:00:00 | 2021-07-12 03:00:00 |
| 2021-07-12 03:00:00 | 2021-07-12 04:00:00 |
| 2021-07-12 04:00:00 | 2021-07-12 05:00:00 |
| 2021-07-12 05:00:00 | 2021-07-12 06:00:00 |