Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT

版权声明:学习交流为主,未经博主同意禁止转载,禁止用于商用。 https://blog.csdn.net/u012965373/article/details/82595470

查询SQL两个表做join操作的时候出现如下问题

Error Code: 1267. Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

解决方法:

使用转换函数:

CONVERT(b.fullCode USING utf8) COLLATE utf8_unicode_ci

具体案例:

select  from table1 as t1 left join table2 as t2 on t1.`key` = CONVERT(t2.indicator_id USING utf8) COLLATE utf8_unicode_ci;

猜你喜欢

转载自blog.csdn.net/u012965373/article/details/82595470