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
Suneel Reddy
Answer Posted / mkumar.it
select no, name,
case amount/abs(amount) when 1 then amount else 0 end credit,
case amount/abs(amount) when -1 then amount else 0 end Debit
from account
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
What is oracle and pl sql?
What is the best free sql database?
What is self-join and what is the requirement of self-join?
What is difference sql and mysql?
Why select is used in sql?
what is a database transaction? : Sql dba
How do I find sql profiler?
Is record in oracle pl sql?
Can sql developer connect to db2?
What are user defined functions?
Is there any restriction on the use of union in embedded sql?
What are the different operators available in sql?
What is scalar and vector?
how do you tune the slow running queries in oracle db , explain the methodology
What is an alias command?