Error

MySQL - column ' ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Dlise 2025. 2. 27. 00:03

GROUP BY가 포함된 SQL문을 실행하려는 과정에서 오류가 발생했다.

column ' ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

 

해결 방법

아래의 stackoverflow 내용을 통해 문제를 해결할 수 있었다.

https://stackoverflow.com/questions/41887460/select-list-is-not-in-group-by-clause-and-contains-nonaggregated-column-inc

 

SELECT list is not in GROUP BY clause and contains nonaggregated column .... incompatible with sql_mode=only_full_group_by

I'm using MySQL 5.7.13 on my windows PC with WAMP Server. My problem is while executing this query SELECT * FROM `tbl_customer_pod_uploads` WHERE `load_id` = '78' AND `status` = 'Active' GROU...

stackoverflow.com

 

아래의 SQL문을 작성해 @@sql_mode에서 'ONLY_FULL_GROUP_BY'를 제거하면 된다.

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

 

이후 @@sql_mode에서 해당 내용이 없어졌는지 확인한다.

select @@sql_mode;