MySQL ---- In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated

2021-09-07 16:34:05 浏览数 (1)

使用 GROUP BY 报错

In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'st

解决方案

  1. 转载:https://cloud.tencent.com/developer/article/1404739
  2. 查询

select version(), @@sql_mode;

  1. 修改

SET sql_mode=(SELECT REPLACE(@@sql_mode,‘ONLY_FULL_GROUP_BY’,’’));

注意

  1. 解决问题的办法不止一种,其他解决办法;
  2. 但是其他的没有解决我的问题,上边方法解决了我的问题,所以记录一下!

0 人点赞