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
what is the difference between a local and a global temporary table? : Sql dba
What is the difference between microsoft access and sql?
Is sqlite thread safe?
What are the types of optimization?
What are system versioned tables?
Explain the uses of database trigger.
How can you fetch common records from two tables?
What are the different tcl commands in sql?
how to fetch alternate records from a table? : Sql dba
what are the advantages and disadvantages of cascading style sheets? : Sql dba
What is left join in postgresql?
Is delete faster than truncate?
what is 'mysqlshow'? : Sql dba
Explain the the update statement in sql?
What is schema in sql?