select sum(decode(balance,'D',amount,0))
SUM_DEBIT,sum(decode(balance,'C',amount,0)) SUM_CREDIT
from mytable
-Original Message-
Situmorang
Sent: Tuesday, April 02, 2002 11:28 AM
To: Multiple recipients of list ORACLE-L
Suppose I have table structure like this:
amount Numeric(10)
select sum(decode(balamce,'D',amount,-1*amount)
from table ;
- Original Message -
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Sent: Monday, April 01, 2002 9:58 PM
Suppose I have table structure like this:
amount Numeric(10)
balance VARCHAR(1)
the balance column
thankyou for help.
Ferry Situmorang:
Using Oracle 8.1.7 Designer 6i R4
PT Perkebunan Nusantara XIII (Persero)
Pontianak-Indonesia
http://www.ptpn13.com
- Original Message -
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 1:28 PM
Select
Select sum(decode(balance, 'D', amount, 0)) Db_Amt, sum(decode(balance, 'C',
amount, 0)) Cr_Amt from ...
HTH!
Aleem
-Original Message-
Sent: Tuesday, April 02, 2002 10:58 AM
To: Multiple recipients of list ORACLE-L
Subject:One sql statement
Suppose I have table structure
you can use decode statement like this for credit return the amount
and for debit return amount with negative value group by name or id
select sum(decode(balance,'C',amount,(amount*-1))),name from temp group by
name;
hope that help you.
-Original Message-
Sent: Tuesday, April 02,
Hi
Try:
Select sum(amount), balance
from table
group by balance
Jack
Ferry Situmorang