a guest Mar 22nd, 2019 62 Never
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`
RAW Paste Data