mysql> SELECT name , address, MAX (age) FROM t GROUP BY name;
報(bào)錯(cuò):
ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP
BY clause and contains nonaggregated column 'mydb.t.address' which
is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by
解決辦法 :
#查看當(dāng)前SQL運(yùn)行模式
show variables like'sql_mode'
#將 ONLY_FULL_GROUP_BY 去掉,或者重置sql_mode為空
set sql_mode= '' ;