Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT *,
- lag(timestamp) over(partition by user_id order by timestamp) as timestamp_lag,
- if(TIMESTAMP_DIFF(timestamp, lag(timestamp) over(partition by user_id order by timestamp),minute)<30,0,1) as session_start
- FROM `table_name`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement