Created
May 16, 2019 20:27
-
-
Save ToddKerpelman/71facf59b949398d7f38de249a6a88b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH week_1_users AS ( | |
SELECT DISTINCT user_pseudo_id | |
FROM `firebase-public-project.analytics_153293282.events_*` | |
WHERE event_timestamp >= UNIX_MICROS(TIMESTAMP("2018-08-08 00:00:00", "-7:00")) | |
AND event_timestamp < UNIX_MICROS(TIMESTAMP("2018-08-15 00:00:00", "-7:00")) | |
AND _TABLE_SUFFIX BETWEEN '20180807' AND '20180815' | |
), | |
week_0_users AS ( | |
SELECT DISTINCT user_pseudo_id | |
FROM `firebase-public-project.analytics_153293282.events_*` | |
WHERE event_name = 'first_open' | |
AND event_timestamp >= UNIX_MICROS(TIMESTAMP("2018-08-01 00:00:00", "-7:00")) | |
AND event_timestamp < UNIX_MICROS(TIMESTAMP("2018-08-08 00:00:00", "-7:00")) | |
AND _TABLE_SUFFIX BETWEEN '20180731' AND '20180808' | |
) | |
SELECT * from week_1_users JOIN week_0_users USING(user_pseudo_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment