For AI agents: an index of this documentation is at https://developer.rippling.com/llms.txt. Public pages have a Markdown version at the same URL with .md added.

Skip to main content
index

LAST_VALUE() Function

Use with AI:Rippling AI ChatGPT Claude Cursor

Description​

Returns the last value in an ordered set of values within a window frame

Syntax​

LAST_VALUE(expression) OVER (
[PARTITION BY partition_expression]
ORDER BY sort_expression
[ROWS BETWEEN frame_spec]

Parameters​

ParameterDescriptionData TypeRequired
expressionColumn or expression to evaluateAnyYes

Rewrite​

Use QUALIFY to filter on window expression results; do not use window functions in WHERE.

Notes​

  • Include an OVER (...) clause with ORDER BY (and optional PARTITION BY) when using this as a window function.

Example​

SELECT
id, LAST_VALUE(full_name) OVER (PARTITION BY department ORDER BY start_date) AS last_name
FROM
rippling.employee.Employee;