|
Hello All, I am stopped at a point.. i need some help from you intelligent guys.. Here is my table.. ID 1 2 3 4 5 6 7 8 9 Now the question is i want to add fourth column Marginprice in my table through t-sql.. (i don't know why but my client has asked me to do so) Which is calculated as basic on this formula.. Based on every product If it is the first day then MarginPrice = Price else MarginPrice = (PreviousDay's MarginPrice - Price)*1.1 + PreviousDay's MarginPrice I am not finding any proper way to do this.. For example For Product1 MarginPrice on 2/1/2001 will be calculated as follows: PreviousDay's MarginPrice = 100 (as it is the first record) So, on 2/1/2001 MarginPrice = (100 - 160)*1.1 + 100 i.e. MarginPrice =34 Now on 3/1/2001.. MarginPrice will be calculated on basis of 34 So, on 3/1/2001 MarginPrice = (34 - 90)*1.1 + 34 i.e. MarginPrice = -27.6 Hope i was able to explain my question.. Thank you all..!! Regards, Paresh Rathod Paresh (VB.NET 2005)
(comments are locked)
|
(comments are locked)
|

