Created
March 31, 2014 14:44
-
-
Save tegansnyder/9893975 to your computer and use it in GitHub Desktop.
Average orders per customer
This file contains 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
SELECT AVG(num_orders) FROM ( | |
SELECT COUNT(customer_id) as num_orders, customer_id FROM sales_flat_order | |
GROUP BY customer_id) as sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment