赞
踩
例:select a.* from tbl_test a LEFT JOIN tbl_test_askforleave b ON a.userid=b.userid AND a.groupCode=b.groupCode
错误提示:
Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation ‘=’
原因:a.groupCode(utf8mb4_general_ci)=b.groupCode(utf8mb4_0900_ai_ci),
设置如下方法仍不生效:
SHOW VARIABLES LIKE ‘%coll%’;
SET GLOBAL collation_connection = ‘utf8mb4_general_ci’;
先执行:
SET collation_database = ‘utf8mb4_general_ci’;
解决方法:查询时给字段设置指定字符集,如:
select a.* from tbl_test a LEFT JOIN tbl_test_askforleave b ON a.userid=b.userid AND convert(a.groupCode using utf8)=convert(b.groupCode using utf8)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。