I've really searched but couldn't find an answer to this one, I have a simple table in my postgres DB;
start_date | end_date | amount
Because the dates aren't continuous and because of the nature of needing a "snapshot date" I'm using a generate_series to create a separate table and attempting to join the two. What I need is that for every row where the date in my generate_series table falls between the start and end date in my table I will sum all of those rows and put that amount next to the date in my generate_series table.
I am not sure how I join the two tables and I feel I need to have some kind of loop that loops through all relevant rows and sums them. Ideally the solution would all be in SQL so that I can plug into Looker as a derived table without the need for pre ETLs.
Any help/thoughts would be greatly appreciated
Thanks