Skip to content

Instantly share code, notes, and snippets.

@miguelbalparda
Created April 3, 2015 19:38
Show Gist options
  • Save miguelbalparda/447573fa7d2820d2c1c3 to your computer and use it in GitHub Desktop.
Save miguelbalparda/447573fa7d2820d2c1c3 to your computer and use it in GitHub Desktop.
SELECT email FROM customer_entity as ce JOIN newsletter_subscriber as ns ON ns.subscriber_email = ce.email AND ns.subscriber_status = 1 JOIN sales_flat_order as sfo ON sfo.customer_id = ce.entity_id JOIN sales_flat_order_item as sfoi ON sfo.entity_id = sfoi.order_id JOIN catalog_product_entity as cpe ON cpe.entity_id = sfoi.product_id WHERE cpe.sku !='' group by ce.email;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment