SELECT OrderProducts.Name AS Product, SUM(OrderProducts.Quantity) AS "Number Sold", SUM(OrderProducts.TotalIncTax) AS Revenue FROM OrderProducts LEFT OUTER 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.Name
Skyvia Query allows you to run SQL queries against databases and cloud applications from web browser. Access and manage your data from anywhere, build reports, arrange your data in the most informative way and simplify your decision-making process easily!