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 payment_log ON orders.OrderID = payment_log.Pay_OrderID
WHERE Order_Entry_System LIKE '%MARKETPLACE%'
AND orderstatus != 'Cancelled'
AND OrderDate >= '2016-06-01 00:00:00'
AND (payment_log.Pay_TransID LIKE '%Walmart%' OR payment_log.Pay_AuthCode LIKE '%Walmart%' Or orders.OrderID IN (1612227, 1615795,1617846,1622001,1623830))
AND (payment_log.Deleted IS NULL OR payment_log.Deleted = 'N')
GROUP BY YEAR(OrderDate), MONTH(OrderDate), DAY(OrderDate)
ORDER BY YEAR(OrderDate) DESC, MONTH(OrderDate) DESC, DAY(OrderDate) DESC