Mysql – Error Code: 1267 Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,NUMERIC) for operation ‘=’ error on simple select query

MySQL

I am getting

#1267 – Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,NUMERIC) for operation '='

this error on below query

SELECT * FROM 
sm_product_inventories_list 
WHERE  inventory_date =  CURDATE() 
AND  inventory_time =  CURTIME()

I tried to change collation of table by

ALTER TABLE sm_product_inventories_list CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci

still I am getting error.
Type of inventory_date is date and inventory_time is varchar

Thanks in advance.

Best Answer

A quick solution is to add "binary" before comparing as follows,

WHERE binary inventory_date = binary CURDATE() AND binary inventory_time = binary CURTIME()