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 to fetch common records from two tables? : Sql dba
What is the difference between functions, procedures, and packages in pl/sql?
Explain some predefined exceptions.
What are the different types of joins in sql?
What are the types of subqueries?
Is pl sql useful?
What are the differences between implicit and explicit cursors?
what are the types of subquery? : Sql dba
What do you understand by exception handling in pl/sql?
What is gpt format?
when MSQL8.0 is in market
How does join work in sql?
describe transaction-safe table types in mysql : sql dba
Why we use cross join?
How long it takes to learn pl sql?