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
How do I run a program in pl sql?
How many types of normalization are there?
What is a sql instance vs database?
Explain architecture of sql server notification services?
What is meant by truncate in sql?
How to avoid duplicate records in a query?
How are functions and procedures called in PL/SQL?
What is sap sql anywhere?
what are all the different types of indexes? : Sql dba
Why is %isopen always false for an implicit cursor?
What is keys and its types?
give the syntax of grant and revoke commands? : Sql dba
How do you drop a trigger?
What type of join is sql join?
Does access use sql?