当前位置: 代码迷 >> 综合 >> Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=
  详细解决方案

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=

热度:60   发布时间:2023-12-22 03:34:52.0

想比较一下,从表结构中除去已有的字段,结果出现问题。

SELECT column_name FROM information_schema.columns WHERE table_schema ='fhlc_stat' AND table_name = 'user_dimension_detail' AND column_name NOT IN (SELECT FIELD FROM fhlc_stat.`user_dimension` );

查了之后发现CONVERT(FIELD USING utf8) COLLATE utf8_unicode_ci,用这个将需要的字段包裹起来就好了。

SELECT column_name FROM information_schema.columns WHERE table_schema ='fhlc_stat' AND table_name = 'user_dimension_detail' AND column_name NOT IN (SELECT CONVERT(FIELD USING utf8) COLLATE utf8_unicode_ci FROM fhlc_stat.`user_dimension` );
  相关解决方案