How to calculate running total in sql backwards

enter image description here

select id,date,amount,SUM (Amount)  OVER (PARTITION BY ID ORDER BY DATE desc)  AS runningbalance from sales

I have tried this to reverse running balance going from the most recent to older records. How can I reverse this to go backwards to give me running balance the other way?



from Recent Questions - Stack Overflow https://ift.tt/3FG6YSV
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)