I have a MySQL query for sales by month report, but when I try to execute it on my Linux box Debian it didn't work anymore. It works on my Windows box, and my query looks like this. I have to order my sales by month, but however doesn't it.
How can I fix it?
SELECT COUNT(*) AS orders, ROUND(SUM(total),2) AS total, MONTHNAME(created_at) AS MONTH
FROM storelte_order
WHERE STATUS = 1
AND YEAR(created_at) = YEAR(CURDATE())
GROUP BY MONTH
ORDER BY created_at ASC;
Error:
22:14:34 call sales_by_month Error Code: 1055. Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'storelte.storelte_order.created_at' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 0.041 sec
------------------------------------------------------------------------