Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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