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 |
kifeda
Posting Yak Master
136 Posts |
Posted - 2005-08-08 : 18:19:07
|
How do I sum two columns? I have a column named TOTALHOURSWORKED and a column named TOTALHOURSWORKEDOT. I tried to sum them like:select sum(totalhoursworked, totalhoursworkedot) as GrandTotalBut that that didn't work because SUM only likes one argument. Any suggestions? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-08-08 : 18:23:21
|
select sum(totalhoursworked + totalhoursworkedot) as GrandTotalTara |
|
|
Nidal
Starting Member
3 Posts |
Posted - 2006-03-10 : 11:03:15
|
quote: Originally posted by tkizer select sum(totalhoursworked + totalhoursworkedot) as GrandTotalTara
|
|
|
Nidal
Starting Member
3 Posts |
Posted - 2006-03-10 : 11:19:50
|
i hope this will be a solution for uselect sum(totalhoursworked + totalhoursworkedot)from <table name>;orselect totalhoursworked,totalhoursworkedot,totalhoursworked + totalhoursworkedot from <table name>;orselect totalhoursworked,totalhoursworkedot,totalhoursworked + totalhoursworkedot as "grandtotal" from <table name>;ororselect totalhoursworked+totalhoursworkedot from <tablename>;orselect sum(totalhoursworked + totalhoursworkedot) as "GrandTotal" from <table name>; |
|
|
|
|
|