-
[Error] Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 해결Error 해결모음 2022. 6. 11. 12:15728x90
Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
이런 에러가 뜨는것은 버전문제이다.
--해결 방법--
1. 쿼리 변경, group by 에 모두 기입
select a1, a2, count(a3) from table1 group by a1, a2; -집계함수 이외의 모든 select 칼럼을 기입
2. 쿼리 변경 , 비 집계 칼럼에 ANY_VALUE() 함수 사용select a1, ANY_VALUE(a2), count(a3) from table1 group by a1;
3. mysql 설정 변경
sql_mode 에서 ONLY_FULL_GROUP_BY 설정을 뺀다
- 설정파일(my.cnf)에서 ONLY_FULL_GROUP_BY 를 찾아 삭제한다.SELECT @@sql_mode; //설정보기
sql_mode 에서 ONLY_FULL_GROUP_BY 설정을 뺀다 - 설정파일(my.cnf)에서 ONLY_FULL_GROUP_BY 를 찾아 삭제한다.
예) vi /etc/my.cnf sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION //ONLY_FULL_GROUP_BY 빼고 입력
728x90'Error 해결모음' 카테고리의 다른 글