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 would concatenate strings in mysql? : Sql dba

651


First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.

1225


What are the different dcl commands in sql?

670


How to get list of all tables from a database?

729


Write a query to display the current date in sql?

623






What is trigger in pl sql?

641


How we can create a table in pl/sql block. Insert records into it? Is it possible by some procedure or function? Please give example?

678


What is dml statement?

608


How can we link a sql database to an existing android app?

643


what is csv? : Sql dba

669


How to know the last executed procedure?

689


Does a primary key have to be a number?

604


How can I see all tables in sql?

640


What is varchar example?

662


What is the unique index?

627