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 / vijay sultampur
Select No No,Name Name,Decode(Amount,Abs(Amount),Amount,0)
Credit, Decode(Amount,Abs(Amount),0,Amount) Debit
From Account;
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
Define overloaded procedure?
How to test for null values?
Define join and name different types of joins?
How many types of keys are there in sql?
Can a primary key be a foreign key?
how to get a list of all tables in a database? : Sql dba
how to shut down the server with 'mysqladmin'? : Sql dba
Is not equal in sql?
How do I filter in sql profiler?
what are wild cards used in database for pattern matching ? : Sql dba
Is and as keyword in pl sql?
What is a sql schema used for?
How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?
What is the difference between a database and a relational database?
What is user defined functions?