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 |
|
Minchu
Starting Member
1 Post |
Posted - 2012-10-30 : 16:32:31
|
| I have a table having only one columnTabValue1234I need the output to beTabValue13610First row is as it is, second row is 1+2(i.e first row+second row), third row is 1+2+3 (i.e first row+second row+third row) and so on.Can i use CTEs with aggregated function. It is throwing error |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-30 : 16:55:28
|
| [code]SELECT CummTabValueFROM Table tCROSS APPLY (SELECT SUM(TabValue) AS CummTabValue FROM Table WHERE TabValue < = t.TabValue )t1ORDER BY TabValue[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|