本文主要是介绍Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
mysql字段编码排序规则不一致导致查询报错:Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=
查询的sql语句为:
SELECT A.`id` FROM `news` A WHERE NOT EXISTS (SELECT B.`news_id` FROM `news_black` B WHERE B.`news_id` = A.`id`)
误把news表的id字段排序规则设置成了utf8_unicode_ci,而news_black表的news_id字段排序规则为utf8_general_ci,导致查询报错。
解决办法,修改两个字段排序规则为一致(utf8_general_ci):
这篇关于Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!