1
votes

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.

1
Does CAST(inventory_time AS TIME) work?Álvaro González

1 Answers

6
votes

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

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