【发布时间】:2013-10-16 18:56:42
【问题描述】:
这是我的问题..
Actual Auction Ammanat id
7000 500 100 228,229
7000 100 100 228,229
7000 900 100 228,229
5000 0 0 230
我想要下面给出的结果
Actual Auction Ammanat Remaining id
7000 500 100 5550 228,229
7000 100 100 5550 228,229
7000 900 100 5550 228,229
5000 0 0 5000 230
这里,Remaining 是 (sum(auction)-actual)。
我正在使用 PostgreSQL。但如果有人知道 SQL Server 中的解决方案,就可以了。
【问题讨论】:
-
(sum(auction)-actual)没有意义。应该是actual - sum(auction)。
标签: sql sql-server postgresql window-functions