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 / john bershan

@ mkumar.it

the query which you have posted will work if the amount
value is greater than zero and will not work in the case
when the vale s zero as it will throw divisor is equal to
zero.please check it.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is serial sql?

699


State few characteristics of pl/sql?

723


What are the sql commands?

792


What are the types of optimization?

686


What is difference between sql and oracle?

773






Is primary key is clustered index?

724


What is a join?

807


What is sqlca in powerbuilder?

745


How to fetch values from testtable1 that are not in testtable2 without using not keyword?

958


What is plpgsql language?

713


what is a trigger in mysql? Define different types of trigger. : Sql dba

729


How to test for null values?

766


What are synonyms in sql?

727


What is online transaction processing (oltp)?

749


how tsql statements can be written and submitted to the database engine? : Transact sql

710