Skip to content

Instantly share code, notes, and snippets.

@javrasya
Last active December 27, 2019 13:36
Show Gist options
  • Save javrasya/6885ea1e78c6f995c7e42cc44bfeb5c1 to your computer and use it in GitHub Desktop.
Save javrasya/6885ea1e78c6f995c7e42cc44bfeb5c1 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
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment