为什么会出现这样的错误:操作'='非法混合归类(utf8_general_ci,IMPLICIT)和(utf8_bin,NONE),这个问题是什么?

时间:2011-11-30 03:01:46

标签: mysql sql collation concat mysql-error-1267

查询:

select *,
       (@page_path = concat(
           @page_path,
           chk_v_application_tree.alias
       )) as path
from chk_v_application_tree 
  

[Err] 1267 - 操作'='的非法混合排序(utf8_general_ci,IMPLICIT)和(utf8_bin,NONE)

1 个答案:

答案 0 :(得分:0)

尝试:

select *,
       (@page_path = concat(
           CONVERT(@page_path USING utf8) COLLATE utf8_bin,
           chk_v_application_tree.alias
       )) as path
from chk_v_application_tree

因为您可能不会在CONCAT函数(utf8_general_ci,utf8_bin)中混合使用charset编码。