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 / vijay sultampur
Select No No,Name Name,Decode(Amount,Abs(Amount),Amount,0)
Credit, Decode(Amount,Abs(Amount),0,Amount) Debit
From Account;
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
what are the advantages of mysql in comparison to oracle? : Sql dba
what is the difference between where clause and having clause? : Sql dba
Can a view be mutating? If yes, then how?
What are all different types of collation sensitivity?
Is sql a backend language?
Does sql*plus also have a pl/sql engine?
What are the sql aggregate functions?
What are the ddl commands?
What are user defined functions?
what are the differences among rownum, rank and dense_rank? : Sql dba
What is embedded sql in db2?
what is the command used to fetch first 5 characters of the string? : Sql dba
what are the nonstandard string types? : Sql dba
How is pl sql different from sql?
What is a database? Explain