Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compute Balance In Query
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01379592
Message ID:
01379608
Views:
25
>>
>>SELECT SUM(ISNULL(Deposit,0) + ISNULL(Payment,0)) AS Balance FROM Register GROUP BY Sequence ORDER BY Sequence
>>
>>Also it's not a good idea to use MONEY type.
>>
>>See http://forums.asp.net/t/1380719.aspx
>
>
>This is not returning the correct results. This returns the value of either column. I want to the balance after either the deposit or payment has been computed.

What exactly do you mean here? It should sum all payments and deposits for this sequence number.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform