phpMyAdmin - #1267 - Illegal mix of collations for operation '<'

耗尽温柔 提交于 2019-12-11 21:05:02

问题


I am getting an error when trying to run the following SQL:

SELECT * FROM syshealth WHERE 'timestamp' < DATE_SUB(NOW(),INTERVAL 15 MINUTE)

I am getting the following error:

#1267 - Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (latin1_swedish_ci,NUMERIC) for operation '<' 

I have my table and database collation set to utf8_unicode_ci

I have read a few articles already, and have tried the top answer here, but without success...

Any more idea's?

EDIT: Additional Info - the 'timestamp' column is of type datetime


回答1:


You need to use ` (backtick) to identify a column if you use single ' , this will be treated as string literal.

SELECT * FROM syshealth WHERE `timestamp` < DATE_SUB(NOW(),INTERVAL 15 MINUTE)


来源:https://stackoverflow.com/questions/26262648/phpmyadmin-1267-illegal-mix-of-collations-for-operation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!