Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Oracle LAG function in TD - response (1) by dnoeth

$
0
0

LAG/LEAD is just a short-cut:

LAG(col,x,val) OVER (ORDER BY col2)
=
COALESCE(MIN(col)
         OVER (ORDER BY col2
               ROWS BETWEEN x PRECEDING AND x PRECEDING)
         , val)

For LEAD replace PRECEDING with FOLLOWING.
Dieter


Viewing all articles
Browse latest Browse all 27759

Trending Articles



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