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 |
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-23 : 03:02:44
|
| TableAItemID Value 1........ 12........ 23.........34.........4For example, if i want to update the value by adding all previous value and itself that is order by itemidResult 1........12........33........64........10Any way to do it in update query?be a hardworking people!! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-23 : 03:13:18
|
| I think no need to update just use this select querySelect ItemId,(Select sum(value) from TableA where ItemId<=T.ItemId) from TableA TMadhivananFailing to plan is Planning to fail |
 |
|
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-23 : 03:18:45
|
| OIC. But this is only select statement. Can i directly use it result to update the table, i mean i worry that the during it sum process, some value will overwrite other value so the result is not correctOf course, it is not a practical use but only interesting q for me!be a hardworking people!! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-23 : 03:28:01
|
| It seems that it is only a presentation issue and I dont think there is need for updationMadhivananFailing to plan is Planning to fail |
 |
|
|
mmarovic
Aged Yak Warrior
518 Posts |
Posted - 2005-08-23 : 10:47:40
|
If you really want it, here it is:declare @value intset @value = 0update tableA set @value = value = value + @value |
 |
|
|
|
|
|