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
what are sequences
Can we join 3 tables in sql?
What is #table in sql?
What is sql key?
What is a string data type in sql?
what is a trigger in mysql? Define different types of trigger. : Sql dba
what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba
What is mutating table error?
What is Collation Sensitivity ? What are the various type ?
What is keys and its types?
What are character functions?
Who developed sql?
What is PL/SQL Records?
How to get list of all tables from a database?
What is the use of & in pl sql?