GrassHopper (11/23/2014)
I've got a complex query i'm trying to write. I want to create a running total column of a calculation( column1 - column2).In the attachment, you will see:
column H = (G-F)
Column I is the Running total
Column J is the same as column H (Column G - Column F)
When the Running total (Column I is Greater than Column L (static value), then Column J = (Column L - Column K) (from the previous record)
First, the JPG is a nice visual but it doesn't help much other than that. Please see the article at the first link under "Helpful Links" in my signature line below for the best way to post some sample data to help us help you. Thanks.
Second, this has been posted under "General". What version of SQL Server are you using? It'll make real difference here.
Third, which column absolutely controls the [font="Arial Black"]order [/font]that the running total should be calculated by.
--Jeff Moden
Change is inevitable... Change for the better is not.