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
When is the update_statistics command used?
Why trigger is used in sql?
What is sql procedures and functions?
how to create a test table in your mysql server? : Sql dba
How do I make sql search faster?
What is the difference between drop and truncate commands?
What is sql injection vulnerability?
Is record in pl sql?
Does truncate need commit?
What is trigger explain it?
which tcp/ip port does sql server run on? : Sql dba
Explain foreign key in sql?
What is blind sql injection?
What is a recursive stored procedure?
What is schema in sql example?