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 difference between a query and a report?
What does count (*) do in sql?
explain the options of myisamchk to improve the performance of a table. : Sql dba
what are set operators in sql? : Sql dba
How do you optimize a query?
Is join and inner join the same?
how to concatenate two character strings? : Sql dba
what is text? : Sql dba
Is nosql faster than sql?
How many sql commands are there?
How do you use join?
What is the use of function "module procedure" in pl/sql?
What does joining a thread mean?
Why are cursors used?
name 3 ways to get an accurate count of the number of records in a table? : Sql dba