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
What is dml statement?
What is basic structure of pl sql?
what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba
what are all the common sql function? : Sql dba
How do I enable sql encryption?
What is varchar sql?
When you have to use a default "rollback to" savepoint of plvlog?
What is column?
What is procedure in pl sql?
How can you maintain the integrity of your database on instances where deleting an element in a table result in the deletion of the element(s) within another table?
Explain architecture of sql server notification services?
What are the types of dbms?
What is parameter substitution in sql?
mention if it is possible to import data directly from t-sql commands without using sql server integration services? If yes, what are the commands? : Transact sql
Explain the difference between triggers and constraints?