Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
shilpash
Posting Yak Master
103 Posts |
Posted - 2012-07-01 : 16:53:51
|
| Id Value Expected values1 100 1002 200 3003 200 5004 500 10005 300 1300I need a new column(Expected Values) this is how i got..100,100+200,200+200+100,500+200+200+100,300+500+200+200+100adding consecutively rows.. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-01 : 17:15:20
|
| [code]SELECT *FROM table tCROSS APPLY (SELECT SUM(Value) AS ExpectedValue FROM table WHERE Id < = t.Id )t1[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|