mysql使用group by 的时候报错,错误信息如下:
1055:ER_WRONG_FIELD_WITH_GROUP: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated
column 'lbparking.tradingrecord.pname' which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by
解决步骤:
一、找到/etc/my.cnf
二、添加如下语句:sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
三、重新启动MYSQL服务
service mysqld stop
service mysqld start
备注:上述解决操作在root账号下进行