当前位置: 代码迷 >> 综合 >> which is not functionally dependent on columns in GROUP BY clause; sql_mode=only_full_group_by
  详细解决方案

which is not functionally dependent on columns in GROUP BY clause; sql_mode=only_full_group_by

热度:4   发布时间:2023-12-18 04:04:47.0

这个问题是数据库设置了only_full_group_by模式:

错误的sql:

SELECT content,teacherId FROM tb_test GROUP BY teacherId;

正确的sql:(因为一个teacherId 会对应多个content的情况所以content要加上any_value())

SELECT any_value(content) AS content,teacherId FROM tb_test GROUP BY teacherId;

  相关解决方案