Skip to content

Instantly share code, notes, and snippets.

@jdwyah
Created February 22, 2015 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdwyah/10ab9c98cfd58072cda3 to your computer and use it in GitHub Desktop.
Save jdwyah/10ab9c98cfd58072cda3 to your computer and use it in GitHub Desktop.
lag_lead as (
select who_identifier, time_period,
lag(time_period,1) over (partition by who_identifier order by who_identifier, time_period),
lead(time_period,1) over (partition by who_identifier order by who_identifier, time_period)
from monthly_usage),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment