select copy.nam, --부등호 큰 쪽
copy.val, --부등호 큰 쪽
sum(org.val) "누계" --부등호 작은 쪽
from (select nam, val
from A
order by nam) org,
(select nam, val
from A
order by nam) copy
where org.nam <= copy.nam --부등호 큰 쪽 기준으로 group by 해야 됨
group by copy.nam, copy.val