标签: sql sql-server
我的数据库表中有三列,即owed,paid和writeoff。在总结paid和writeoff并从owed中减去后,我需要计算未结总数。
owed
paid
writeoff
owed-(paid+writeoff)
答案 0 :(得分:2)
select sum(t.owed - (t.paid + t.writeoff)) AS result from {your_table} t