SELECT date_format(DATE(a.date_created),'%Y-%c-%d') As dateCreate, SUM(a.sm) As sumAmount, sum(orderCount) as countSum FROM (SELECT date_created, sum(amount) AS sm, count(id) AS orderCount FROM orders WHERE date_created BETWEEN CONCAT(DATE(date_creat…