
Querydsl로 group By를 사용하여 쿼리문을 작성하였다.
Expression #7 of SELECT list is not in GROUP BY clause and contains nonaggregated column
'fittingnote.producthit2_.hits' which is not functionally dependent on columns in GROUP BY
clause; this is incompatible with sql_mode=only_full_group_by
정상적으로 동작할거라고 생각했지만 위와 같은 오류가 발생했다.
sql_mode의 only_full_group_by 속성이 활성화 되어 있어 현재 group By절과 호환되지 않는다는 문제라고 한다.
해결할 수 있는 방법으로는
1. Mysql에서 only_full_group_by를 비활성화 시키는 방법
2. select절 안에 count문을 제외한 컬럼을 group By안에 넣는 방법

2번째 방법을 통해서 해결할 수 있었다.
'Spring' 카테고리의 다른 글
[Spring] Spring AOP Logging 공통 관심사 분리 (0) | 2023.01.04 |
---|---|
[Design Pattern] 추상 팩토리 패턴 적용 (0) | 2022.12.25 |
[Spring Boot] Kotlin+Spring Boot Validation (0) | 2022.12.22 |
[Spring] Controller Test Code 작성 (0) | 2022.12.13 |
[Design Pattren] 템플릿 메서드 패턴 (0) | 2022.12.09 |
댓글