Skip to content

Instantly share code, notes, and snippets.

@Mr--John-Doe
Last active March 24, 2022 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr--John-Doe/afd6f946d57b590e361d2135c8a2b420 to your computer and use it in GitHub Desktop.
Save Mr--John-Doe/afd6f946d57b590e361d2135c8a2b420 to your computer and use it in GitHub Desktop.
WITH first_user_login AS (
SELECT user, MIN(login_ts) AS min_date
FROM logins
GROUP BY 1
)
SELECT user, platform as first_login_platform, ...
FROM logins
WHERE (user, login_ts) IN (SELECT user, min_date FROM first_user_login)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment