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
Does inner join return duplicate rows?
What is primary key and foreign key?
Does sql use python?
What is localdb mssqllocaldb?
Write a sql query to get the third highest salary of an employee from employee_table?
How do I access sql anywhere database?
What are the different types of dbmss?
what are sequences
How do you sort in sql?
Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?
What are the benefits of stored procedures?
How sql query is executed?
How many types of triggers are there in pl sql?
What is varray in pl sql?
Why do we use set serveroutput on?