以下是我用于计算月收入和费用的选择查询
select sum(dr)exp,sum(cr) inc
from vMonthlyExpenses
这将返回
exp inc
$14,751,199.09 $14,800,985.09
所以我的问题是如何获得利润值以及上面的选择,预期结果是
exp inc profit
$14,751,199.09 $14,800,985.09 $49,786.00
答案 0 :(得分:1)
SELECT sum(dr) exp,
sum(cr) inc,
sum(cr)-sum(dr) profit
FROM vMonthlyExpenses