[英]create view (subtract two different columns on different tables)
Can I create another view? 我可以创建另一个视图吗? subtract from total_deposit - total_loan_amount
从total_deposit中减去-total_loan_amount
CREATE VIEW v_total_deposit (total_deposit) as
select sum(deposit_amount)
from deposit;
CREATE VIEW v_total_loan (total_loan) as
SELECT SUM(loan_amount)
from loan;
@moonir01 MINUS is a set operator, not arithmetic one. @ moonir01 MINUS是一个集合运算符,不是算术运算符。 You have to subtract two numbers:
您必须减去两个数字:
CREATE VIEW balance
AS
SELECT NVL((SELECT TOTAL_DEPOSIT FROM V_TOTAL_DEPOSIT),0) - NVL((SELECT TOTAL_LOAN FROM V_TOTAL_LOAN),0) AS balance
FROM DUAL
but you really don't need these views. 但您实际上不需要这些视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.