我有一个按月销售报告的MySQL查询,但当我尝试在我的Linux box Debian上执行它时,它不再起作用了。它可以在我的Windows机器上运行,我的查询如下所示。我不得不按月订购我的销售额,但是不是这样吗?
我怎么才能修复它?
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;错误:
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
------------------------------------------------------------------------发布于 2017-10-04 12:30:57
据我所知,你可以用两种方法修复它
https://stackoverflow.com/questions/46556969
复制相似问题