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
Explain the advantages and disadvantages of stored procedure?
what is top in tsql? : Transact sql
How to get unique records from a table?
Does sql full backup truncate logs?
Explain the significance of the & and && operators in pl sql.
Hi how to import oracle sequence in Informatica? Please write stored procedure code that will import oracle sequence in Informatica SP transformation as per below scenario Oracle table product list Pro_id, pro_name 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights Now a new flat file with new product list needs to be added to oracle table product list with oracle sequence. flat file product Prono,pro_name, 1, 20 watt tube light 2, 30 watt tube light & target should be like 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights. 104, 20 watt tube light 105, 30 watt tube light thks reg suvarna joshi suvarnaatsuvarna@rediffmail.com
Explain the difference between drop and truncate commands in sql?
Which version of sql do I have?
How to select random rows from a table?
Why do we use sql constraints? Which constraints we can use while creating database in sql?
What are the disadvantages of not performing database normalization?
what is sp_pkeys? : Transact sql
What is sql engine in oracle?
How many types of literals are available in pl sql?
Which are the different types of indexes in sql?