Last active
December 21, 2015 07:49
Revisions
-
swrobel renamed this gist
Sep 25, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
swrobel renamed this gist
Sep 25, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
swrobel created this gist
Aug 19, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ SELECT p.id, sum(quantity) AS num_sold FROM spree_orders o JOIN spree_line_items li ON o.ID = li.order_id JOIN spree_variants v ON li.variant_id = v.id JOIN spree_stock_items i ON v.id = i.variant_id JOIN spree_products p ON v.product_id = p.id WHERE o.state = 'complete' GROUP BY p.id