我有下表:
Name Amount DB CR
Person A 1000 0 0
Person A 5000 100 300
Person A 3000 200 0
Person A 0 100 300
Person B 1000 0 0
Person B 5000 0 0
Person B 3000 0 0
Person B 0 1000 2000
Person C 10000 0 0
Person C 50000 0 0
我需要在信用卡和借记卡之后显示总金额。
Person=sum(Amount)-(sum(DB)+sum(CR)).
如何编写查询以在Oracle中显示输出?
答案 0 :(得分:0)
根据你提出的公式:
select name, sum(Amount)-(sum(DB)+sum(CR))
from your_table
group by name;
...