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 / shailesh
SELECT NO,NAME,DECODE(GREATEST
(AMOUNT,0),0,AMOUNT,0) "DEBIT",DECODE(GREATEST
(AMOUNT,0),0,0,AMOUNT) "CREDIT" FROM ACCOUNT
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What do you understand by pl/sql cursors?
Why are sql stored procedures used?
Explain the significance of the & and && operators in pl sql.
what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba
What is the use of procedures?
can a stored procedure call itself or recursive stored procedure? : Sql dba
how to fetch alternate records from a table? : Sql dba
What are different types of statements supported by sql?
Mention what is the function that is used to transfer a pl/sql table log to a database table?
What is foreign key sql?
How does left join work in sql?
What is the difference between microsoft access and sql server?
what is a foreign key ? : Sql dba
What is the syntax to add a record to a table?
What is cursor status?