问题
I got this error;
Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
I changed "Collations" to "utf8mb4_unicode_ci". Then tables were truncated and I re-import rows again. But still getting same error
回答1:
I am guessing you have different collations on the tables you are joining. It says you are using an illegal mix of collations in operations =
.
So you need to set collation. For example:
WHERE tableA.field COLLATE utf8mb4_general_ci = tableB.field
Then you have set the same collations on the =
operation.
Since you have not provided more info about the tables this is the best pseudo code I can provide.
回答2:
For Join Query I used this piece of query to resolve such error:
select * from contacts.employees INNER JOIN contacts.sme_info
ON employees.login COLLATE utf8mb4_unicode_ci = sme_info.login
Earlier using the following query, I was getting the same error:
select * from contacts.employees LEFT OUTER JOIN contacts.sme_info
ON employees.login = sme_info.login
Error: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
I don't know much about collations but seems like both tables follow different rules for character set. Hence, the equal to operator was not able to perform. So in the first query I specified a collation set to collect and combine.
来源:https://stackoverflow.com/questions/44027987/illegal-mix-of-collations-utf8mb4-unicode-ci-implicit-and-utf8mb4-general-ci