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
How much ram can sql express use?
Is a table valued function object?
How do you know if a relationship is 2nf?
Why coalesce is used in sql?
Can you sum a count in sql?
Do we need to create index on primary key?
What is auto increment feature in sql?
Why does sql need a server?
What is a primary key called that is made up of more than one field?
What is the use of sqlerrd 3?
What is graph sql?
What are tables in sql?
What are pl/sql cursors?
how to use regular expression in pattern match conditions? : Sql dba
What is sql performance tuning?