Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT
`date`,
COALESCE(
number,
LAST_VALUE(number, TRUE) OVER(
ORDER BY `date`
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
)
) as last_not_null_number,
estimate,
COALESCE(
client,
LAST_VALUE(client, TRUE) OVER(
ORDER BY `date`
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
)
) as last_not_null_client
FROM my_table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment