Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum ( ) function in T-SQL Query

Status
Not open for further replies.

YaBabyYa

Programmer
Jul 26, 2007
21
CA
Hello,

I have a table, the table has as subset of columns N

I need to Sum( N ) and set the value in a column Rank

Below I am showing an example, with Rank showing the calculation I must achieve.

********************************************************

Table
-----------------------------------
Col_1 Col_2 .. Col_N Rank
-----------------------------------
row_1 0.25 0 0 0.25 Sum(1..N) = 0.5
row_2 0.5 0 0 0.10 Sum(1..N) = 0.6


*******************************************************
The SQL Sum() function only operates on a single column .. for all the rows. Is there such a function for summing across columns for 1 row?
 
how about

Code:
col1 + col2 + col3

Hope it helps

Alex

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top