Skip to content

Instantly share code, notes, and snippets.

@tegansnyder
Last active January 2, 2016 20:59
Show Gist options
  • Select an option

  • Save tegansnyder/8360414 to your computer and use it in GitHub Desktop.

Select an option

Save tegansnyder/8360414 to your computer and use it in GitHub Desktop.
Customers who purchased less than $100 in product
SELECT COUNT(entity_id) as num_custs FROM (
SELECT entity_id
FROM `sales_flat_order`
GROUP BY customer_email
HAVING SUM(base_subtotal) < 100
) sub_query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment