Created
June 2, 2012 13:52
Revisions
-
drewgillson revised this gist
Jun 2, 2012 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,9 @@ SELECT b.email, c.value AS name, a.updated_at, d.added_at, d.product_id, e.name, SUM(g.qty_ordered) AS purchased FROM `wishlist` AS a INNER JOIN customer_entity AS b ON a.customer_id = b.entity_id INNER JOIN customer_entity_varchar AS c ON a.customer_id = c.entity_id AND c.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = b.entity_type_id) INNER JOIN wishlist_item AS d ON a.wishlist_id = d.wishlist_id INNER JOIN catalog_product_flat_1 AS e ON d.product_id = e.entity_id LEFT JOIN sales_flat_order AS f ON f.customer_email = b.email LEFT JOIN sales_flat_order_item AS g ON (f.entity_id = g.order_id AND g.sku LIKE CONCAT(e.sku,'%') AND g.product_type = 'simple') GROUP BY b.email, c.value, a.updated_at, d.added_at, d.product_id, e.name -
drewgillson created this gist
Jun 2, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ SELECT b.email, c.value AS name, a.updated_at, d.added_at, d.product_id, e.name, SUM(g.qty_ordered) AS purchased FROM `wishlist` AS a INNER JOIN customer_entity AS b ON a.customer_id = b.entity_id INNER JOIN customer_entity_varchar AS c ON a.customer_id = c.entity_id AND c.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'firstname' AND entity_type_id = b.entity_type_id) INNER JOIN wishlist_item AS d ON a.wishlist_id = d.wishlist_id INNER JOIN catalog_product_flat_1 AS e ON d.product_id = e.entity_id LEFT JOIN sales_flat_order AS f ON f.customer_email = b.email LEFT JOIN sales_flat_order_item AS g ON (f.entity_id = g.order_id AND g.sku LIKE CONCAT(e.sku,'%') AND g.product_type = 'simple') GROUP BY b.email, c.value, a.updated_at, d.added_at, d.product_id, e.name