select quantity from (select sum(quantity) over(order by rownum) quantity from table1) order by quantity desc
select sum(b.quantity ) from table a, table b where a.quantity <= b.quantity group by a.quantity ;
不好意思,忘记说了要对数据库每条记录进行update
update table c set c.quantity = ( select d.quantity_sum from ( select a.quantity quantity,sum(b.quantity) quantity_sum from table a,table b where a.quantity <= b.quantity group by a.quantity ) d where c.quantity = d.quantity );
(select sum(quantity) over(order by rownum) quantity from table1)
order by quantity desc
from table a,
table b
where a.quantity <= b.quantity
group by a.quantity ;
set c.quantity = ( select d.quantity_sum
from ( select a.quantity quantity,sum(b.quantity) quantity_sum
from table a,table b
where a.quantity <= b.quantity
group by a.quantity ) d
where c.quantity = d.quantity );