MySQL group 时遇到非聚集的(nonaggregated)是什么鬼?

在数据库查询使用 group by 子句时,蹦出来这个错误:

Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated

解决办法:

sudo mysql -uroot -p
mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

详见:https://stackoverflow.com/a/41145619/3054511

你可能感兴趣的:(MySQL)