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 |
|
phrankbooth
Posting Yak Master
162 Posts |
Posted - 2007-09-19 : 11:16:14
|
| Hi,The only SUM samples I've seen just do SUM over a column. But I need to add up fields within a row.ie: select SUM(a, b, c) from xHow would this be done?Thanks!--PhB |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-19 : 11:17:14
|
SELECT Col1, SUM(a + b + c)FROM Table1GROUP BY Col1SELECT Col1, a + b + c AS ColZFROM Table1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
phrankbooth
Posting Yak Master
162 Posts |
Posted - 2007-09-19 : 11:19:51
|
| Silly me, I just thought of that.Thanks!--PhB |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-20 : 03:19:25
|
quote: Originally posted by Peso SELECT Col1, SUM(a + b + c)FROM Table1GROUP BY Col1SELECT Col1, a + b + c AS ColZFROM Table1 E 12°55'05.25"N 56°04'39.16"
Dont forget NULLs MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|