Skip to content

Instantly share code, notes, and snippets.

@GreatPotato
Created April 12, 2013 13:23
Show Gist options
  • Save GreatPotato/5371959 to your computer and use it in GitHub Desktop.
Save GreatPotato/5371959 to your computer and use it in GitHub Desktop.
Gets the top selling products in LemonStand
SELECT t2.sku, t2.name, t2.price, SUM(t1.quantity)
FROM shop_order_items t1
LEFT JOIN shop_products t2
ON t1.shop_product_id = t2.id
GROUP BY t2.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment