Skip to content

1939. Users That Actively Request Confirmation Messages

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
WITH
  UserToTimestampDiff AS (
    SELECT user_id,
      TIMESTAMPDIFF(
        SECOND,
        time_stamp,
        LEAD(time_stamp) OVER(
          PARTITION BY user_id
          ORDER BY time_stamp
        )
      ) AS timestamp_diff
    FROM Confirmations
  )
SELECT DISTINCT user_id
FROM UserToTimestampDiff
WHERE timestamp_diff <= 24 * 60 * 60;