Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SUM negative amount
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00527742
Message ID:
00527756
Views:
32
Actually i want to sum negative amounts (Credits) And Positive Amounts (Debits)
A bit like your example, my statement for VFP table would be like yours:
select sum(Amount * iif(Amount < 0, 1, 0)) as Credit, sum(Amount * iif(Amount > 0, 1, 0)) as Debit from SomeTable where some_condition
This works fine with VFP Tables but i am looking for an SQL Server 2000 statement.

Thanks

>>Anybody knows how i could sum all Credit and debit amount in an SQL2000 Table and get the result separated in the same cursor.
>>
>>Thanks
>
>A little more info please. Do you have a field that contains the transaction type that indicates if the record is a Credit, debit, etc.? You want the credits total separated from the debits total?
>
>select sum(credit * iif(TransType = "C", 1, 0)) as Credit, sum(debit * iif(TransType = "D", 1, 0)) as Debit from SomeTable where some_condition
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform