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
Is it possible to create startup or shutdown trigger for on-schema?
How many types of functions are there in sql?
What is difference between ms sql and mysql?
how are mysql timestamps seen to a user? : Sql dba
What is recursive stored procedure?
What are the uses of merge?
What are all different types of collation sensitivity?
What is the purpose of the partition table?
Which is faster truncate or drop?
What is sql profiler in oracle?
what are the different type of normalization? : Sql dba
List the ways to get the count of records in a table?
What is a relationship and what are they?
Can we use distinct and group by together?
What are the syntax and use of the coalesce function?