mysql> SELECT name , address, MAX (age) FROM t GROUP BY name;
报错:
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
解决办法 :
#查看当前SQL运行模式
show variables like'sql_mode'
#将 ONLY_FULL_GROUP_BY 去掉,或者重置sql_mode为空
set sql_mode= '' ;