问题描述:MySQL进行字符串比较时发生错误:
- 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
错误如下:[Err] 1267 - Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='
- 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;
联系客服