添加两列并从另一列中减去

时间:2017-07-26 15:54:33

标签: sql sql-server

我的数据库表中有三列,即owedpaidwriteoff。在总结paidwriteoff并从owed中减去后,我需要计算未结总数。

owed-(paid+writeoff)

1 个答案:

答案 0 :(得分:2)

select
  sum(t.owed - (t.paid + t.writeoff)) AS result
from 
  {your_table} t