Skip to content

Instantly share code, notes, and snippets.

@leafo
Created August 20, 2014 20:20
Show Gist options
  • Save leafo/990f574527a05e1dfcc0 to your computer and use it in GitHub Desktop.
Save leafo/990f574527a05e1dfcc0 to your computer and use it in GitHub Desktop.
top referrer domains
select domain, count(*) from (select (regexp_matches(purchase_referrers.referrer, '//(.*?)/'))[1] as domain from purchase_referrers inner join purchases on purchases.id = purchase_referrers.purchase_id where purchases.status = 1 and purchase_referrers.type = 2) as domains group by domain order by count desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment