SQL Server Running Balance
Posted on 2016-10-06
I need to update a column in my table called qty_on_hand and have tried using the code below in an update statement, but cannot get it to work. Any ideas would greatly be appreciated.
SELECT Trans_Date, trans_qty,
SUM(trans_qty) OVER(ORDER BY Trans_Date ROWS UNBOUNDED PRECEDING) AS qty_on_hand_running_bal