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 19:00 Last Update: 24-Nov-15 8:54