Skip to content

Instantly share code, notes, and snippets.

@jonhilgart22
Created October 16, 2018 16:52
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 jonhilgart22/0a029163b0a0c8ccfa29a7b8d58848b1 to your computer and use it in GitHub Desktop.
Save jonhilgart22/0a029163b0a0c8ccfa29a7b8d58848b1 to your computer and use it in GitHub Desktop.
--waitlist
select
distinct
us.name,
us.email,
c.code as pricing_plan,
c.amount,
u.created_at::date as entered_credit_card_at
from user_events u
join coupons c
on c.id = json_extract_path_text(properties, 'coupon_id')
join analytics.acquisition_credit_card_source_tracking a
on a.user_id = u.user_id
and a.subscription_id is null
join users us
on us.id = u.user_id
where
event_name in ('Payment Form Completed', 'Requested Access')
and u.created_at >= getdate() - '30 days'::interval
order by 5 desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment