Reason for my vote of 4
For most people this is the easiest way to implement a running total. Although many MVP's and diehards will tell you this is not a guaranteed method. It's been pretty reliable for me.
Lets say, you have CustomerId and Ordervalue columns in table. And DateOrder. Then, the query will be:
SELECT CustomerId, SUM(OrderValue) OVER(Partition By CustomerID order by DateOrder) as CustomerTotal FROM CustomerOrder
Last Visit: 31-Dec-99 18:00 Last Update: 22-Jun-17 21:18