Last active
August 29, 2015 13:56
-
-
Save kalenjordan/9234803 to your computer and use it in GitHub Desktop.
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 characters
/* Here are some example custom report queries for use with the custom | |
* reports module | |
* | |
* http://magemail.co/free-custom-reports-module-for-magento/ | |
*/ | |
/* | |
* Number of items in order | |
* | |
* Useful to find out whether customers are buying a given product | |
* standalone or with other products. | |
*/ | |
SELECT i.qty_ordered AS `Items in Order`, | |
COUNT(*) AS `Number of Orders`, | |
SUM(base_grand_total) AS `Total Revenue` | |
FROM sales_flat_order AS o | |
LEFT JOIN sales_flat_order_item AS i ON i.order_id = o.entity_id | |
WHERE i.`sku` IN ('SKU') | |
GROUP BY i.qty_ordered | |
LIMIT 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment