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 / saravana sundar
select sno,name,decode(sign(amount),1,0,amount)debit,decode
(sign(amount),-1,0,amount)credit from account
/
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What steps server process has to take to execute an update statement?
How does pl sql work?
Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql
How can you fetch first 5 characters of the string?
what are the limitations of identity column? : Transact sql
What are user defined functions?
How can I see all tables in sql?
Is postgresql a server?
What is sql injection owasp?
What are the ddl commands?
What jobs use sql?
What are different types of tables in sql?
How to select 10 records from a table?
How to pronounce postgresql?
Does pl/sql support create command?