I've asked this question before, but the only answer was very complicated. I'm hoping that someone can help with a simpler solution. Here is a link to my initial question. Here is my table of data:
I got that output by using the following code:
SELECT date_trunc('day', el.paid_at) as the_day, round(sum(el.amount::numeric/100),0) as amount_raised, sum(round(sum(el.amount::numeric/100),0)) OVER (order by date_trunc('day', el.paid_at)) as sum FROM extended_lineitems el WHERE el.paid_at is not null and el.istip is FALSE GROUP BY the_day ORDER BY the_day
I would like the "sum" column to reset when it eclipses 1,000,000. You'll see in the link to my previous question that a user posted a recursive approach. I was unable to mimic that, and hope that there is another way around it.