Anyone able to help me with a query I'm trying to ...
# sql
n
Anyone able to help me with a query I'm trying to get working? I want to generate variable time series based on two values I have stored in my database. I can get it working when I hard code the values but I don't know how to make them come from a subquery. I'm a postgres noob so I feel like it's definitely me and should be possible. Here's my query with hard coded values
Copy code
SELECT t.day::timestamp
FROM   generate_series(timestamp '2022-07-20 09:00:00.000000 +00:00'
                     , timestamp '2022-07-20 21:00:00.000000 +00:00'
                     , interval  '1 hour') AS t(day);
Ok, I got it working. Why is it that after freaking 3 hours of frustration I ask the question and something pops up in my mind to try and it works.
Copy code
SELECT t.day::timestamp
FROM   generate_series((SELECT '2022-07-20 21:00:00.00000 +00:00'::timestamp)
                     , timestamp '2022-07-20 21:00:00.000000 +00:00'
                     , interval  '1 hour') AS t(day);