Back
JOIN table by varchar fields - Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_genera
2013-04-07 MySQL
2013-04-07 MySQL
Usually, we will using integer fields to join two table, however, today I have a case need to use a varchar field to join the tables and then get the error "Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation", search the error on google and finally I got the solution as below
SELECT a.* FROM a INNER JOIN b ON CAST(a.field AS CHAR) = CAST(b.field AS CHAR)