PostgreSQL · Function
lag
LAG returns a value from an earlier row in the same window partition. It is useful for comparing each row with a previous row.
Last updated
Syntax
lag(value anycompatible [, offset integer [, default anycompatible ]]) → anycompatibleIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
leadfirst_valuelast_valuenth_value