Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi Friends,

I want sql query for the below

Hrs1             Hrs2  
10                12
8                 10
15                7



I want to take sum(sum(Hrs1),sum(Hrs2)) as Total

I tried the above query but it will shows an error. Please anyone help me.

Thanks,
Nandha
Posted
Updated 6-Aug-13 23:03pm
v2

Try sum(Hrs1)+sum(Hrs2) as Total
 
Share this answer
 
SQL
select hrs1 + hrs2 as totalhrs from tableName

OR
SQL
--for summary, this will give single row as answer.
select sum(hrs1 + hrs2) as totalhrs from tableName

Happy Coding!
:)
 
Share this answer
 
SELECT (SUM(hrs1 )+SUM(hrs2)) as 'totalhrs' from tableName.this can get
 
Share this answer
 
VB
try this...:)


SQL
SELECT Tot = ISNULL(Value1, 0) + ISNULL(Value2, 0)
FROM Table
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900