It's easy to get the previous value with OLAP-functions:
select cust_id, date,
min(Closing_Inventory)
over (partition by cust_id
order by date
rows between 1 preceding and 1 preceding) as Opening_Inventory
from tab
qualify Opening_Inventory is not null
Simply use this query in a UPDATE FROM.
It's easy to get the previous value with OLAP-functions:
Simply use this query in a UPDATE FROM.