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 |
mangyun
Starting Member
8 Posts |
Posted - 2007-12-07 : 03:43:48
|
-- sorry, didn't search the forum befor. got it already. thanks.table 1aaa bbb c 001 abc 1 002 abc 2 003 abc 3 004 abc 4 table 2aaa bbb c dd001 abc 1 1002 abc 2 3003 abc 3 6004 abc 4 10How can I create the second table, without loop ?The last column(dd) = previous (dd )+ current (c)ex. last record -> 10 = 6 + 4ThanksMangyun |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-12-07 : 03:50:50
|
[code]select, aaa, bbb, c, dd = (select sum(c) from table1 x where x.aaa <= t.aaa)from table1 t[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
mangyun
Starting Member
8 Posts |
Posted - 2007-12-07 : 04:04:20
|
thanks KH. such a quick response.Problem solved thanks 2 U.Mangyun |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-07 : 05:56:36
|
Alternatively, if you use front end application, you can do the same there using while loopMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|