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

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 14773

Trending Articles