我有两个表,例如emp,在两个表中都有两个薪水列的客户
emp_sal cusotmer_sal
-------- -------------
1000 3000
2000 1000
3000 5000
我想在单个结果中输出合并总薪水,如
sum(sal)
---------
15000
如果有人知道,可以发表评论 谢谢!!
答案 0 :(得分:2)
您可以使用两个子查询的总和,每个子查询计算工资总和:
SELECT
(SELECT SUM(emp_sal) FROM emp) +
(SELECT SUM(customer_sal) FROM customer)
FROM dual
答案 1 :(得分:0)
试试这个
select sum(emp_sal) from emptable
+
select sum(cusotmer_sal) from customertable