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 / mkumar.it
select no, name,
case amount/abs(amount) when 1 then amount else 0 end credit,
case amount/abs(amount) when -1 then amount else 0 end Debit
from account
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
what is sql server agent? : Sql dba
Explain constraints in sql?
Which kind of parameters cannot have a default value in pl sql?
which command using query analyzer will give you the version of sql server and operating system? : Sql dba
What are sql injection vulnerabilities?
Can you selectively load only those records that you need? : aql loader
Which is better trigger or stored procedure?
What program will open a mdb file?
What does sql stand for?
What is fmtonly in sql?
What is a sql statement?
What is percent sign in sql?
What is the source code of a program?
describe mysql connection using mysql binary. : Sql dba
How to create your own reports in sql developer?