Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,NUM

SHOW VARIABLES LIKE 'coll%';

 


 执行下面语句

SELECT * 
 FROM
        threat_event
    WHERE expirationTime<0 
        AND '2012-11-09 09:23:05' > ADDTIME(startTime, '30')

 出错:

SQL 错误 写道
Query : SELECT * FROM utmp.threat_event WHERE expirationTime<0 AND '2012-11-09 09:23:05' > ADDTIME(startTime, '30...
Error Code : 1267
Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,NUMERIC) for operation '>'
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000

 使用错误中写的编码方式:latin1_swedish_ci

执行:

SET collation_connection = 'latin1_swedish_ci';

 再次执行

SHOW VARIABLES LIKE 'coll%';

 查看结果为:



 其中collation_connection变为:latin1_swedish_ci

再次执行报错的SQL语句,执行成功

 

 

你可能感兴趣的:(sql,for,operation,Illegal,and,of,MIX,NUMERIC),'>',collations,COERCIBLE))