Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=
問題描述:MySQL進(jìn)行字符串比較時(shí)發(fā)生錯(cuò)誤:
?
SELECT
a.equ_no,
b.fullCode
FROM
equipment a,
(
SELECT
t.*, getEquTypeFullCode (t.equType_id) AS fullCode
FROM
equ_type t
) b
WHERE
substring(a.equ_no, 1, 5) = b.fullCode
錯(cuò)誤如下:
?
[Err] 1267 - Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='
解決方法:將比較等式一邊進(jìn)行字符串轉(zhuǎn)換,如改為“CONVERT(b.fullCode USING utf8) COLLATE utf8_unicode_ci”
?
SELECT
a.equ_no,
b.fullCode
FROM
equipment a,
(
SELECT
t.*, getEquTypeFullCode (t.equType_id) AS fullCode
FROM
equ_type t
) b
WHERE
substring(a.equ_no, 1, 5) = CONVERT(b.fullCode USING utf8) COLLATE utf8_unicode_ci;
來源:https://blog.csdn.net/hellostory/article/details/7266447
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 包粽子的灰水怎么做
- 下一篇: 分布式应用解耦利器rabbitmq