1.问题

今天又在mysql中遇到了,吐血。

2.解决方案

SQL最后加上

COLLATE utf8mb4_unicode_ci

SELECT t2.cust_id as cust_id_ex,t1.* from
(
SELECT * from credit_nigeria.apply WHERE updateTime>"2019-11-10"
) t1
RIGHT JOIN ( SELECT cust_id from bank_nigeria.ng_trans_record WHERE update_Time>"2019-11-18 04" and update_Time<"2019-11-18 05" and pay_type="xx"
) t2
on
t1.custid=t2.cust_id COLLATE utf8mb4_unicode_ci order by t2.cust_id, updateTime desc ;

在哪里加?

我也不太知道。。。都是试。表后面,字段后面,变量后面

 案例:

案例一

案例二:

3.原理

utf8mb4对应的排序字符集有utf8mb4_unicode_ci、utf8mb4_general_ci.

utf8mb4_unicode_ci和utf8mb4_general_ci的对比:

  • 准确性:
  1. utf8mb4_unicode_ci是基于标准的Unicode来排序和比较,能够在各种语言之间精确排序
  2. utf8mb4_general_ci没有实现Unicode排序规则,在遇到某些特殊语言或者字符集,排序结果可能不一致。

但是,在绝大多数情况下,这些特殊字符的顺序并不需要那么精确。

  • 性能
  1. utf8mb4_general_ci在比较和排序的时候更快
  2. utf8mb4_unicode_ci在特殊情况下,Unicode排序规则为了能够处理特殊字符的情况,实现了略微复杂的排序算法。

但是在绝大多数情况下发,不会发生此类复杂比较。相比选择哪一种collation,使用者更应该关心字符集与排序规则在db里需要统一。

Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '<>'的更多相关文章

  1. 【MySQL】Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and ...

    线上遇到这个问题,详细信息如下: SQL state [HY000]; error code [1267]; Illegal mix of collations (utf8mb4_general_ci ...

  2. java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='

    查询视图时报错:java.sql.SQLException: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_ ...

  3. MySQL replication illegal mix of collations

    MySQL replication case 一则 转载:http://www.vmcd.org/2013/09/mysql-replication-case-%E4%B8%80%E5%88%99/ ...

  4. b-is-in- (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='") SELECT id FROM qqzoneshuoshuo WHERE words=

    db-is-in- (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci, ...

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

    MySQL字符串比较bug: select * from table_a a left join table_b b on a.field_a = b.field_b   error: Illegal ...

  6. 数据库 BUG:Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=

    在mysql5中遇到的问题: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) f ...

  7. Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLIC

    在mysql5中遇到的问题: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) f ...

  8. Django的admin管理系统写入中文出错的解决方法/1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‘locate’

    Django的admin管理系统写入中文出错的解决方法 解决错误: 1267  Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and ( ...

  9. 解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER

    今天在用java与mysql数据库时发现Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER ...

随机推荐

  1. Fiddler之手机抓包

    1.Fiddle设置端口,Tools->Options->Connections, 2.手机设置代理服务器: 注意:要保证手机和PC电脑IP在同一个网段(或者同一个网关) (1).安卓手机 ...

  2. javaIO -- File源码

    一.简介 文件和目录路径名的抽象表示. 用户界面和操作系统使用依赖于系统的路径名字符串命名文件和目录. 这个类提供了一个抽象的,独立于系统的层次化路径名的视图. 二.代码 (一).属性详情 //平台的 ...

  3. Python基础运算符(算数、比较、赋值、逻辑、成员)

    Python运算符有(算数运算符.比较运算符.赋值运算符.逻辑运算符.位运算符.成员运算符.身份运算符): 本程序包含算数.比较.赋值.逻辑.成员运算符. 1.运算符测试 #!/usr/bin/pyt ...

  4. Codeforces 1245 E. Hyakugoku and Ladders

    传送门 显然这个图是个 $DAG$ ,那么就可以考虑跑 $dp$ 了 先考虑没有梯子的情况,首先把每个位置标号,越后面的位置编号越小,终点位置编号为 $1$ 那么从终点往起点 $dp$ ,枚举当前位置 ...

  5. Asp.net core 学习笔记 2.2 migration to 3.0

    Ef core 3.0 一些要注意的改变 refer : https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaki ...

  6. deferred.promise.then().then()异步链式操作(Chain operation)

    //deferred.promise.then().then() deferred.promise.then(function () { console.log('1 resolve'); retur ...

  7. (三)SpringBoot之配置文件详解:Properties和YAML

    一.配置文件的生效顺序,会对值进行覆盖: 1. @TestPropertySource 注解 2. 命令行参数 3. Java系统属性(System.getProperties()) 4. 操作系统环 ...

  8. robot framework 如何获取隐藏元素的文本,以及可见元素的文本

    1.下图是获取可见元素的文本内容,运行后得到:${B_name}=公告管理:假设公告管理不可见,那么${B_name}=‘’(为空)

  9. 如何自定义starter

    在springboot启动流程的系列文章中,我们看过了springboot的自动配置机制,本文将基于自动配置机制自定义一个自动配置的starter示例 正文 模块结构 首先,我们准备两个模块servi ...

  10. 数据库入门(mySQL):创建数据库

    基于JetBrains DataGrip创建数据库.SQL语句创建数据库 MySQL数据库存储引擎和数据类型 创建数据库表及基本操作 导出数据库.删除数据库.导入数据库 一.基于JetBrains D ...