基本/基本查询为:
SELECT SUM(field) AS AT, `table`.* FROM `table` WHERE id = '1';
我有一张桌子
field `id` mediumint(8)
field `field` int(12)
在我的本地MySQL 5.6.27中全部运行FINE。
在远程MySQL 5.7.28中,我收到此错误:
#1140 - In aggregated query without GROUP BY,
expression #2 of SELECT list contains nonaggregated column
'BD.TABLE.id'; this is incompatible with sql_mode=only_full_group_by
从逻辑上讲,我不想在MySQL配置中进行任何更改/修改。
QUERY是否可能修复错误?
谢谢
答案 0 :(得分:0)
感谢{Nick,GMB}的帮助。当我将QUERY更改为:
SELECT SUM(field) AS AT, `table`.* FROM `table` WHERE id = '1' GROUP BY `table`.`id`;
一切正常。
(仅添加“ 由table
组。id
”解决该问题)
:-)