Created
January 9, 2020 19:27
-
-
Save tjwaterman99/6e8358abb7821cf854cc451f9aad59e6 to your computer and use it in GitHub Desktop.
This file contains 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
# Flags users with a pageview during 2019. Faster than joining! | |
select | |
user.id, | |
exists( | |
select 1 | |
from pageviews | |
where pageviews.user_id=users.id | |
and pageviews.created_at between '2019-01-01' and '2020-01-01' | |
limit 1 | |
) as "active_2019" | |
from users |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment