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 / ehtesham malik
Select no,name, 0 Debit, amount Credit
from temp
where amount >0
union
Select no,name, amount Debit, 0 Credit
from temp
where amount < 0
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
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
what is sql server agent? : Sql dba
what are aggregate and scalar functions? : Sql dba
what are the advantages of sql ? : Sql dba
what is bcp? When does it used? : Sql dba
Does group by remove duplicates?
If a cursor is open, how can we find in a pl/sql block?
Is primary key clustered index?
what are all the common sql function? : Sql dba
Is primary key always clustered index?
how many tables will create when we create table, what are they? : Sql dba
what is schema? : Sql dba
what is collation? : Sql dba
What is the current version of sql?
What is your daily office routine?