0 pts.
 combine and sum fields in sql
SQL
I have a file with approx. 20 columns: 4 of the columns are numeric: finchg1, finchg2, finchg3, finchg4 - one of the columns is acct number. each acct has only one row. I need to combine the four fields into one - can I use the sum function to do this - how? Thank you

Software/Hardware used:
ASKED: October 28, 2007  3:47 PM
UPDATED: October 29, 2007  2:47 AM

Answer Wiki:
Hi, I'm not sure if I understood your question correctly. But the SUM function is used to sum vertically and not horizontally. To sum up the values of the 4 fields, you can simply use the following syntax: SELECT finchg1+finchg2+finchg3+finch4 AS TotalFinChg FROM <TableName> if you want the grand total of the sum olf the four fields, SELECT SUM(finchg1+finchg2+finchg3+finch4) AS GrandTotalFinChg FROM <TableName>
Last Wiki Answer Submitted:  October 29, 2007  2:47 am  by  GAMina   0 pts.
All Answer Wiki Contributors:  GAMina   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _