This question was born in my mind looking at this kind of code:
select sum(value)
into positive
from my_table
where value > 0;
select sum(value)
into negative
from my_table
where value < 0;
This works well for take the totals of this table.
But, my question is how I can get the sub-totals of my_table
using only a statement.
expected result:
Having this data on my_table
VALUE
-----
1.0
-2.0
3.0
-4.0
5.0
-6.7
8.9
I'd a DML statement who can give me this output
positive | negative
---------+---------
17.9 | -12.7
Is this kind of operation possible?
If yes, how can i get it?
Best Answer