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 is 19 null in sql?
How do I start sql profiler?
What is the difference between microsoft sql and mysql?
Can we use delete in merge statement?
How many sectors are in a partition?
what is the difference between union and union all? : Sql dba
What is aggregate function in sql?
what does the t-sql command ident_incr does? : Transact sql
What type of join is sql join?
what are dynamic queries in t-sql? : Transact sql
Explain aggregate functions are available there in sql?
What is data type in database?
What are the built in functions of sql?
how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba
What is pessimistic concurrency control? : Transact sql