I'm running this SQL statement
select sum(AMOUNT), AMOUNT_TYPE, GL_ACCOUNT_ID
from RECEIVABLE_DIST
group by GL_ACCOUNT_ID, AMOUNT_TYPE
which returns
AMOUNT TYPE GL_ACCOUNT_ID
500.00 CR 0110-000
100.00 DR 0110-000
which means that my total for account 0110-000 should be 400.00. Instead of manually making that calculation, is there a way to change my SQL statement to use a conditional summing? If the amounts type is CR, sum it as a positive number, if type is a DR, sum it as a negative.
Any ideas would be greatly appreciated.
Sheldon
select sum(AMOUNT), AMOUNT_TYPE, GL_ACCOUNT_ID
from RECEIVABLE_DIST
group by GL_ACCOUNT_ID, AMOUNT_TYPE
which returns
AMOUNT TYPE GL_ACCOUNT_ID
500.00 CR 0110-000
100.00 DR 0110-000
which means that my total for account 0110-000 should be 400.00. Instead of manually making that calculation, is there a way to change my SQL statement to use a conditional summing? If the amounts type is CR, sum it as a positive number, if type is a DR, sum it as a negative.
Any ideas would be greatly appreciated.
Sheldon