Anyone has a clever way to solve this kinds of issues and craft a query which produces the desired result as in the table above?
Thinking in terms of theory - you need to calculate the first row and then calculate the next row using data from the first row. Then calculate the third row using data from the second row (you might need to carry-forward some value from the first row so that the third row can see them...). That sounds like the algorithm for iteration which is implemented in SQL via "WITH RECURSIVE".
David J.
Yea, I kind of figured RECURSIVE CTE was the way foreward...
If anyone has got this working, give me a tip:-)