小编典典

MySql中非法混合的排序规则错误

mysql

刚刚从上一个问题得到了这个答案,就可以了!

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

但是当我在其中添加额外的位时会出现以下错误:

文档#1267-操作’=’的排序规则(latin1_swedish_ci,IMPLICIT)和(latin1_general_ci,IMPLICIT)的非法混合

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


阅读 307

收藏
2020-05-17

共1个答案

小编典典

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

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

我遇到了同样的错误,这种花招对我有效。

2020-05-17