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 / mkumar.it
select no, name,
case amount/abs(amount) when 1 then amount else 0 end credit,
case amount/abs(amount) when -1 then amount else 0 end Debit
from account
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
what is bcp? When does it used? : Sql dba
how to return query output in html format? : Sql dba
Is full outer join same as cross join?
Write a sql query to convert all character to uppercase after hypen.
What are few of the schema objects that are created using PL/SQL?
Can we use two order by clause in query?
What is schema in sql?
What is crud sql?
Is there any restriction on the use of union in embedded sql?
Is truncate ddl or dml?
how to include character strings in sql statements? : Sql dba
What is %type in pl sql?
what is commit? : Sql dba
What are the properties of a transaction?
i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this