By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
with tab (Customerid, OrderNumber, amount) as
(
select 112,4344,20 from dual union all
select 112,7678,10 from dual union all
select 112,8766,30 from dual union all
select 34 ,6577,15 from dual union all
select 34, 4566,5 from dual
)
select Customerid as custid,
OrderNumber as srcnumber,
sum(amount) over (partition by Customerid) as amount
from tab
order by custid desc
CUSTID | SRCNUMBER | AMOUNT |
---|---|---|
112 | 4344 | 60 |
112 | 7678 | 60 |
112 | 8766 | 60 |
34 | 6577 | 20 |
34 | 4566 | 20 |