mysql sql运行模式报错解决办法

2016-11-20  本文已影响0人  yundGo

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= '' ;
上一篇 下一篇

猜你喜欢

热点阅读