[HY000][1267] Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
在进行表关联查询时报错,由于表的字符集不一样导致。
解决方案:
- ALTER TABLE users CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
- 将比较等式一边进行字符串转换,如改为“CONVERT(b.id USING utf8) COLLATE utf8_unicode_ci”
例子:
select *
from 表1 a
left join 表2 b
on a.policy_id = CONVERT(b.id USING utf8) COLLATE utf8_unicode_ci