问题:mysql5.7,执行sql语句报错:In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'department_id'; this is incompatible with sql_mode=only_full_group_by

解决办法:

①通过navicat,新建查询窗口,输入select @@global.sql_mode来查看当前数据库的sql_mode属性值

MySQL执行多表联查时,报错ln aggregated query without GROUP BY

②复制上面截图查询结果,重新赋值时,去掉ONLY_FULL_GROUP_BY,执行成功后,就可以将ONLY_FULL_GROUP_BY模式默认设置为关闭状态:

MySQL执行多表联查时,报错ln aggregated query without GROUP BY

③查询是否关闭,执行①步骤语句,发现已关闭ONLY_FULL_GROUP_BY模式,关闭连接再重新连接即可执行之前报错的语句。

MySQL执行多表联查时,报错ln aggregated query without GROUP BY

更多解决办法参考该博客:https://blog.csdn.net/Peacock__/article/details/78923479

相关文章:

  • 2022-12-23
  • 2021-07-26
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
猜你喜欢
  • 2021-11-04
  • 2021-05-31
  • 2021-11-12
  • 2021-07-16
  • 2021-10-02
  • 2021-04-15
  • 2022-01-05
相关资源
相似解决方案