MySQL 출현 ONLYFULL_GROUP_BY 해결 방법

1646 단어 데이터베이스
MySQL에 다음과 같은 오류가 발생했을 때: MySQLdb.exceptions.OperationalError: (1055, “Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘bttv.t_account_category.account_category_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by”)
해결 방법: sqlmode에서 only 제거full_group_by:
set sql_mode=(select replace(@@sql_mode,'ONLY_FULL_GROUP_BY','')); 
set @@global.sql_mode=(select replace(@@sql_mode,'ONLY_FULL_GROUP_BY','')); 

좋은 웹페이지 즐겨찾기