Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save digisavvy/6315f4e9e0464f089e8b384e51171821 to your computer and use it in GitHub Desktop.
Save digisavvy/6315f4e9e0464f089e8b384e51171821 to your computer and use it in GitHub Desktop.
SELECT la.license_id, COUNT(*) as num_activations, c.id as customer_id, c.email, la.site_name
FROM wp_edd_license_activations la
INNER JOIN wp_edd_licenses l ON la.license_id = l.id
INNER JOIN wp_edd_orders o ON l.payment_id = o.id
INNER JOIN wp_edd_customers c ON o.customer_id = c.id
WHERE la.activated = 1
GROUP BY la.license_id, la.site_name, c.id, c.email
ORDER BY num_activations DESC
LIMIT 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment