Skip to content

Instantly share code, notes, and snippets.

@kbariotis
Last active August 29, 2015 14:13
Show Gist options
  • Save kbariotis/cad6e13f3d0c50078d63 to your computer and use it in GitHub Desktop.
Save kbariotis/cad6e13f3d0c50078d63 to your computer and use it in GitHub Desktop.
Magento's Product Buyers
SELECT DISTINCT o.customer_id, ce.email FROM sales_flat_order_item i
JOIN sales_flat_order o ON o.entity_id = i.order_id
JOIN customer_entity ce ON ce.entity_id = o.customer_id
WHERE o.customer_id IS NOT NULL
AND i.sku = 'PRODUCT_SKU'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment