Skip to content

1107. New Users Daily Count 👎

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
WITH
  UserToLoginDate AS (
    SELECT
      user_id,
      MIN(activity_date) AS login_date
    FROM Traffic
    WHERE activity = 'login'
    GROUP BY 1
  )
SELECT
  login_date,
  COUNT(*) AS user_count
FROM UserToLoginDate
WHERE DATEDIFF('2019-06-30', login_date) <= 90
GROUP BY 1;