Last active
February 6, 2022 10:56
-
-
Save Mr--John-Doe/c6c4f2ad869316faf9720f853e02752f 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
WITH base as ( | |
SELECT * | |
, LAG(login_date) OVER (PARTITION BY username ORDER BY date) AS previous_login_date | |
FROM sales_site.login | |
) | |
SELECT * | |
FROM base | |
WHERE login_date between $FROM_DATE and $TO_DATE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment