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
What is dynamic query?
Which data type is a composite type?
Is it possible to create startup or shutdown trigger for on-schema?
What is field delimiter?
what is csv? : Sql dba
What are types of exception?
what is 'mysqldump'? : Sql dba
how can we optimize or increase the speed of a mysql select query? : Sql dba
What is lookup table in sql?
What is sql data?
Explain isolation levels. : Transact sql
How to set up sql*plus output format in oracle?
what is acid property in database? : Sql dba
How do I pipe the output of one isql to another?
Does a join table need a primary key?