Nag
Nag

Reputation: 15

From Two tables i want sum salary

I have two tables like emp, customer with two salary columns in both tables

emp_sal           cusotmer_sal
--------         -------------
1000               3000
2000               1000
3000               5000

I want output combined sum salary in single result like

sum(sal)
---------
15000

could please comment if anyone knows Thank You!!

Upvotes: 1

Views: 52

Answers (2)

Rahul Tripathi
Rahul Tripathi

Reputation: 172568

try this

select sum(emp_sal) from emptable 
+ 
select sum(cusotmer_sal) from customertable

Upvotes: 0

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522292

You could use a summation of two subqueries, each one calculating the sum of salary:

SELECT
    (SELECT SUM(emp_sal) FROM emp) +
    (SELECT SUM(customer_sal) FROM customer)
FROM dual

Upvotes: 2

Related Questions