Querying sql 2000 using values from previous rows
I'm bumping my head around this for a few days. What I need is to calculate several discounts aplied cascading to one initial value per document, per line
The catch is I'm using SQL 2000 server , so no with cte code. 🙁
In line 2 The final value is the final value from line 1 multipled by the percentage of line 2.
Is this even possible? I can have a multiple (n) discounts per line.
I took a look at running totals, but the values is changing from one line to another, so summing is not the way.
I need the Discount and Final columns by query. I have made a column rownumber on the left, but that only worked for two lines of discounts… 🙁
Please help. Thank you.