Skip to content

Instantly share code, notes, and snippets.

@javrasya
Last active December 27, 2019 13:34
Show Gist options
  • Save javrasya/5bfc3a45f6388a1a388874a14e8e1321 to your computer and use it in GitHub Desktop.
Save javrasya/5bfc3a45f6388a1a388874a14e8e1321 to your computer and use it in GitHub Desktop.
select
user_id,
LAST_VALUE(location)over w,
event_time
from my_users
window as (
user_id by category
order by event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment