Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Medalink/6015225 to your computer and use it in GitHub Desktop.
Save Medalink/6015225 to your computer and use it in GitHub Desktop.
SELECT customer_id, customer_email, customer_firstname, customer_lastname, group_concat(si.sku SEPARATOR ',') as skus, SUM(subtotal_invoiced) AS cv
FROM sales_flat_order as so
INNER JOIN sales_flat_order_item AS si ON si.order_id = so.entity_id
GROUP BY customer_email
ORDER BY SUM(subtotal_invoiced) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment