MySQL – Joining table with different charset in a view

character-setMySQLschemaview

I want to join tables from two different schemas. But the problem is both schemas follow different charset utf8_general_ci & utf8mb4_unicode_ci.

When i do a join on both tables, it works. But, when i create a view with same query and do a select on the view, it throws an error

Error Code: 1267. Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='

Best Answer

Try using CONVERT() to change the Chararcter Set first:

ON Convert(t1.f1 USING utf8mb4) COLLATE utf8mb4_unicode_ci = t2.f2