我可以创建另一个视图吗?从 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;
答案 0 :(得分:0)
@ moonir01 MINUS是一个集合运算符,而不是算术运算符。你必须减去两个数字:
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
但你真的不需要这些观点。