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 / saravana sundar
select sno,name,decode(sign(amount),1,0,amount)debit,decode
(sign(amount),-1,0,amount)credit from account
/
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
How to create an array in pl/sql?
what are properties of a transaction? : Sql dba
what is 'trigger' in sql? : Sql dba
Can instead of triggers be used to fire once for each statement on a view?
How do I count rows in sql?
What is self-join and what is the requirement of self-join?
What normalization means?
Write a unique difference between a function and a stored procedure.
what is isam? : Sql dba
How many types of normalization are there?
How do I make my sql query run faster?
What is the usage of distinct keyword?
how can we find the number of rows in a table using mysql? : Sql dba
Does oracle use sql?
How to return multiple rows from the stored procedure?