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

Sliding Window Syntax - response (1) by dnoeth

$
0
0

Hi John,
LEAD and LAG are just shortcuts for a basic OLAP function:

select id, yr, value,
  min(yr) 
  over (partition by id 
        order by yr
        rows between 1 following and 1 following) as next_yr, -- Oracle's LAG
  min(value) 
  over (partition by id 
        order by yr.
        rows between 1 following and 1 following) as next_value
from test1
qualify next_value is not null -- not the last row
order by id, yr

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>