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
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 ? | 4 Yes | 0 No |
Post New Answer View All Answers
What are the different types of database management systems?
explain mysql aggregate functions. : Sql dba
Is sql port 1433 encrypted?
Explain the working of foreign key?
What is trigger explain with example?
Can we call procedure in select statement?
What is nested table in pl sql?
What is sql integrity?
What is the use of desc in sql?
What is the difference between pl and sql?
Mention what is the use of function "module procedure" in pl/sql?
Describe different types of general function used in sql?
What are types of exception?
Explain isolation levels. : Transact sql
What is row_number () in sql?