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

how many tables will create when we create table, what are they? : Sql dba

531


What is the purpose of using pl/sql?

653


Why cross join is used?

622


What are the usages of sql?

557


Which are the different case manipulation functions in sql?

528






how to write date and time literals? : Sql dba

519


Why is nosql good?

585


how can we repair a mysql table? : Sql dba

533


What is difference between mysql and postgresql?

504


What is the difference between delete and truncate commands?

504


what is the difference between primary key and unique key? : Sql dba

516


Is sql low level language?

567


How do I remove all records from a table?

555


Can we connect to postgresql using sql developer?

480


What are analytic functions in sql?

539