Skip to content

Instantly share code, notes, and snippets.

@tegansnyder
Created March 31, 2014 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tegansnyder/9893975 to your computer and use it in GitHub Desktop.
Save tegansnyder/9893975 to your computer and use it in GitHub Desktop.
Average orders per customer
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