SELECT 
	MONTH(OrderDate) AS month, 
	DAY(OrderDate) AS day, 
	YEAR(OrderDate) AS year, 
	COUNT(OrderID) AS Total_orders, 
	SUM(paymentamount- IFNULL(salestax1,0) - IFNULL(salestax2,0) - IFNULL(salestax3,0)) AS TotalSales
FROM orders
JOIN customers ON orders.CustomerID = customers.CustomerID
WHERE Order_Entry_System LIKE '%MARKETPLACE%'
	AND OrderStatus != 'Cancelled'
	AND OrderDate >= '2014-06-01 00:00:00'
	AND DATE(orderdate) <= CURDATE()
	AND (customers.EmailAddress LIKE '%@marketplace.amazon.com%' OR customers.EmailAddress = 'amazon-orders@vacpartswarehouse.com')
GROUP BY MONTH(OrderDate), DAY(OrderDate), YEAR(OrderDate)
ORDER BY YEAR(OrderDate) DESC, MONTH(OrderDate) DESC, DAY(OrderDate) DESC