Orders by items sold

BigCommerce

 

BigCommerce is the leading e-commerce platform for running an online store.

A summary of all items sold for the selected date range

Query Text

SELECT OrderProducts."ProductId", OrderProducts."Sku", OrderProducts."Name", COUNT(OrderProducts."OrderId") AS "Orders", SUM(OrderProducts."Quantity") AS "Unit Sold", SUM(OrderProducts."TotalIncTax") AS "Revenue"
  FROM OrderProducts
INNER JOIN Orders AS "OrderProducts_Orders" ON OrderProducts."OrderId" = "OrderProducts_Orders"."id"
WHERE ("OrderProducts_Orders"."Status" != 'Cancelled' AND "OrderProducts_Orders"."Status" != 'Refunded' AND date(date("OrderProducts_Orders"."DateCreated"), 'start of month') = date('now', 'localtime', 'start of month'))
GROUP BY OrderProducts."ProductId", OrderProducts."Sku", OrderProducts."Name"
ORDER BY OrderProducts."Name"
  

Open Query