Database/Mysql & MyBatis
Illegal mix of collations
코딩은 내 밥줄
2024. 9. 17. 15:05
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation 'like'
다른 문자의 집합과 조회하려할때 발생하는 오류이다
COLLATE utf8mb4_unicode_ci을 추가하면 조회할때 COLLATE으로 문자를 일치시킬 수 있다.
SELECT
t1.*,
t2.username,
CONVERT(t1.image USING UTF8) AS imgsrc,
DENSE_RANK() OVER (ORDER BY t1.score DESC) AS rank
FROM
game_title t1
LEFT JOIN
userTable t2 ON t1.creator = t2.email
WHERE
t1.title LIKE ? COLLATE utf8mb4_unicode_ci OR t1.code LIKE ? COLLATE utf8mb4_unicode_ci
ORDER BY
t1.score DESC