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 / ajit nayak
select no, name,
case sign(amt) when 1 then amt else 0 end crd,
case sign(amt) when -1 then amt else 0 end debt
from account;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the largest value that can be stored in a byte data field?
What is gpt format?
How do you copy a table in sql?
Is inner join same as self join?
How exception is different from error?
Is and as keyword in pl sql?
How many sectors are in a partition?
what is datawarehouse? : Sql dba
What are the benefits of pl/sql packages?
What is cost in sql execution plan?
What are some predefined exceptions in pl/sql?
What is sql in java?
How can I tell if sql is running?
What is rank () in sql?
How does sql*loader handles newline characters in a record? : aql loader