I'm trying to figure out a way in which to calculate the following in SQL:
Where r and W is static (0.2 , 0.4) respectively. The x resembles age, and does never exceed 68.
My Database has columns for x, r and W, where x is different for each observation.
My initial thought was a while loop, but i'm not able to construct a while loop, that does something like :
select * , 0 as n
while n < 68 - (x + 1)
begin
(POWER((1 + r) / (1 + W)) , n)
set n = n + 1
end
from data
Hopefully the pseudo-code above illustrates what i am trying to implement.
Thanks in advance!
