SQL Update table with cumulative value
问题 I have this table: Date |StockCode|DaysMovement|OnHand 29-Jul|SC123 |30 |500 28-Jul|SC123 |15 |NULL 27-Jul|SC123 |0 |NULL 26-Jul|SC123 |4 |NULL 25-Jul|SC123 |-2 |NULL 24-Jul|SC123 |0 |NULL The reason only the top row has an OnHand value is because I can get this from another table that stores the current qty on hand for any stock code. The other records in the table are taken from another table that logs all the movement for any given day. I want to update the above table so that the OnHand