include antes in net profit calculation

This commit is contained in:
sqlcoder 2008-12-13 01:15:25 +00:00
parent b62d1fb2a9
commit a426ec9434

View File

@ -711,8 +711,9 @@ class FpdbSQLQueries:
( select # profit from handsplayers/handsactions
hprof.gameTypeId, sum(hprof.profit) sum_profit
from
(select hp.handId, h.gameTypeId, hp.winnings, SUM(ha.amount)
costs, hp.winnings - SUM(ha.amount) profit
(select hp.handId, h.gameTypeId, hp.winnings,
coalesce(hp.ante,0) + SUM(ha.amount) costs,
hp.winnings - (coalesce(hp.ante,0) + SUM(ha.amount)) profit
from HandsPlayers hp
inner join Hands h ON h.id = hp.handId
inner join HandsActions ha ON ha.handPlayerId = hp.id