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 / shailesh
SELECT NO,NAME,DECODE(GREATEST
(AMOUNT,0),0,AMOUNT,0) "DEBIT",DECODE(GREATEST
(AMOUNT,0),0,0,AMOUNT) "CREDIT" FROM ACCOUNT
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the use of count (*) in sql?
What do you mean by “trigger” in sql?
When do we use triggers?
Can we insert data into materialized view?
What is the use of partition by in sql?
How to use transactions efficiently : transact sql
How to move files from one directory to another in pl sql?
Why procedure is used in sql?
Which is faster view or stored procedure?
What is an inconsistent dependency?
How do I run a script in sql developer?
Whis is not false in primary key?
What is inner join in sql?
Does access use sql?
what is the difference between inner and outer join? Explain with example. : Sql dba