Skip to content

Instantly share code, notes, and snippets.

@jthandy
Created April 14, 2016 17:39
Show Gist options
  • Select an option

  • Save jthandy/9981657e344551ad1d8d27e41e76cd2f to your computer and use it in GitHub Desktop.

Select an option

Save jthandy/9981657e344551ad1d8d27e41e76cd2f to your computer and use it in GitHub Desktop.
with email_summary as (
select *
from {{env.schema}}.mailchimp_email_summary
), best_day_of_week as (
select date_part(dow, sent_date), avg(opened::float)
from email_summary
group by 1
order by 1
), best_hour_of_day as (
select date_part(hr, sent_date), avg(opened::float)
from email_summary
group by 1
order by 1
)
select *
from best_day_of_week
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment