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:
00527750
Views:
31
>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
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform