use below logic
UPDATE t
SET result = COALESCE(t1.result * t1.ref * (1 + t.ref),t.result)
FROM Table t
CROSS APPLY (SELECT MAX(result) AS result,EXP(SUM(LOG((1+COALESCE(ref,0))))) AS ref
FROM Table
WHERE eDate < t.eDate
)t1
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c
No comments:
Post a Comment