Last active
May 22, 2020 12:38
-
-
Save Veenap/ef96ad7c77e162fce49bee0e3b898aa2 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
CREATE TABLE FIRST_REV_DATE_TABLE AS | |
SELECT | |
anonymous_id, rev_date as first_rev_date | |
FROM | |
( | |
SELECT anonymous_id, | |
DATE_TRUNC('d', sent_at) as rev_date, | |
RANK() OVER (PARTITION by anonymous_id ORDER BY sent_at DESC) as rank, | |
FROM | |
RUDDER.track | |
WHERE | |
event=’revenue’ | |
) | |
WHERE | |
rank = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment