Illegal mix of collations error in MySql(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、用户名、评级、月份
推荐答案
检查每个表的排序规则类型,并确保它们具有相同的排序规则.
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 中的非法混合排序规则错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySql 中的非法混合排序规则错误
基础教程推荐
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 无法解决整理冲突 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
