MySql中的非法排序规则错误混合 [英] Illegal mix of collations error in MySql

查看:140
本文介绍了MySql中的非法排序规则错误混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只需从上一个问题中得到这个答案,它就可以治疗!

Just got this answer from a previous question and it works a treat!

SELECT username, (SUM(rating)/COUNT(*)) as TheAverage, Count(*) as TheCount 
FROM ratings WHERE month='Aug' GROUP BY username HAVING TheCount > 4
ORDER BY TheAverage DESC, TheCount DESC

但是当我在其中多插一点时,就会出现此错误:

But when I stick this extra bit in it gives this error:

文档#1267-非法混合使用 校对 (latin1_swedish_ci,IMPLICIT)和 (latin1_general_ci,IMPLICIT)用于 操作'='

Documentation #1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation '='

SELECT username, (SUM(rating)/COUNT(*)) as TheAverage, Count(*) as TheCount FROM 
ratings WHERE month='Aug' 
**AND username IN (SELECT username FROM users WHERE gender =1)**
GROUP BY username HAVING TheCount > 4 ORDER BY TheAverage DESC, TheCount DESC

表为:

id, username, rating, month

推荐答案

检查每个表的排序规则类型,并确保它们具有相同的排序规则.

Check the collation type of each table, and make sure that they have the same collation.

在那之后,还要检查您在操作中使用的每个表字段的排序规则类型.

After that check also the collation type of each table field that you have use in operation.

我遇到了相同的错误,这种技巧对我有效.

I had encountered the same error, and that tricks works on me.

这篇关于MySql中的非法排序规则错误混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆