꼬꼬마

postgresql - lead, lag over

song’s 2017. 6. 7. 17:15

SELECT 

LEAD(id) OVER () AS prev, -- offset rows after the current row within the partition

LAG(id) OVER AS next -- offset rows before the current row within the partition