Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

need help in implementing a scenario - response (1) by dnoeth

$
0
0

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.


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>