Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Sum in SQL server

$
0
0

ID B C
1  2 9 ( C is sum of column B 2+4+3) row 1+2+3
2  4 8 (C is sum of column B 4+3+1) row 2+3+4
3  3 5 (C is sum of column B 3+1+1) row 3+4+5
4  1 6 (C is sum of column B 1+1+4) row 4+5+6
5  1 5 (C is sum of column B 1+4+0) row 5+6+0
6  4 4

how do I get column C by sum of 3 rows in column B 

using SQL server 2008R2


Viewing all articles
Browse latest Browse all 23857

Trending Articles