Hello All,
Could any well write a query for the following scenario.
Account(table name)
No Name Amount
1 ABCD 2000.00
2 DEFG -2000.00
3 GHIJ 3000.50
4 JKLM 4000.00
5 MNOP 6000.00
O/p Should be in this format
No Name Credit Debit
1 ABCD 2000.00 0
2 DEFG 0 -2000.00
3 GHIJ 3000.50
4 JKLM 0 -4000.00
5 MNOP 6000.00 o
could any one give appropriate query for this
Thnks in Advance
Answer Posted / omi naik
select no, name,
decode (sign(amount),1 , amount , 0) credit,
decode (sign(amount),-1 , amount , 0) debit
from account
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Which software is used for pl sql programming?
What is application trigger?
What is a ddl command?
What is record in pl sql?
What is db journal file?
Which is faster union or join?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
explain the advantages and disadvantages of stored procedure? : Sql dba
How to start oracle sql developer?
Do we need to create index on primary key?
How to avoid duplicate records in a query?
How many aggregate functions are available there in sql?
What is sql resultset?
How to run sql commands in sql*plus?
Define commit?