|
| Total Answers and Comments: 4 |
Last Update: December 07, 2008 Asked by: srydhar |
|
| | |
|
No best answer available. Please pick the good answer available or submit your answer. | |
March 16, 2007 22:29:03 | #2 |
| svj2000 |
|
Member Since: March 2007 Contribution: 1 |
RE: How to add positive and negative numbers in a sing...
| table temp with a column num of type number
select sum(case when num > 0 then num else null end) pos sum(case when num < 0 then num else null end) neg from temp |  | | Is this answer useful? Yes | No | | |
|
| |
|
December 24, 2007 08:05:20 | #3 |
| Rina_S |
|
Member Since: December 2007 Contribution: 2 |
RE: How to add positive and negative numbers in a single column and output them to two different columns
| E.g. SELECT * FROM TAB1; COL1 C ----- - -1 A -2 A 1 B 2 B SELECT DECODE(SIGN(COL1) -1 col1 null) A DECODE(SIGN(COL1) 1 COL1 NULL) B FROM TAB1; A B ----- ---------- -1 -2 1 2 |  | | Is this answer useful? Yes | No | | |
|
| |
Go To Top
|