Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre

场景

今天写sql的时候遇到个报错Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre,查了下大概意思是mysql5.7及以上版本SELECT列表的表达式不在GROUP BY子句中,并且包含非集合。

解决

windows 修改配置文件 my.ini,linux 修改配置文件 my.cnf
在mysqld 下添加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

posted @ 2022-09-18 16:43  __、  阅读(117)  评论(0)    收藏  举报