SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT  *,
  2. lag(timestamp) over(partition by user_id order by timestamp) as timestamp_lag,
  3. if(TIMESTAMP_DIFF(timestamp, lag(timestamp) over(partition by user_id order by timestamp),minute)<30,0,1) as session_start
  4. FROM `table_name`
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top