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 / 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 ? | 10 Yes | 0 No |
Post New Answer View All Answers
how many tables will create when we create table, what are they? : Sql dba
What is the best sql course?
Is inner join faster than left join?
what are aggregate and scalar functions? : Sql dba
how to start mysql server? : Sql dba
Do we need to rebuild index after truncate?
Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me
Can delete statement be rollbacked?
Is primary key always clustered index?
define sql insert statement ? : Sql dba
What is the current version of sql?
how to use regular expression in pattern match conditions? : Sql dba
what are the advantages of sql ? : Sql dba
How do I remove duplicates in two columns?
how to escape special characters in sql statements? : Sql dba