Remove annoying collation [mysql]
2011-07-12 | 9:48 am | Kein Kommentar »
The problem
select t.id from tmplay as t, postpl as p where p.zip = t.zip; ERROR 1267 (HY000): Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_german1_ci,IMPLICIT) for operation '='
There is the rub
select table_schema, table_name, column_name, character_set_name, collation_name from information_schema.columns where collation_name = 'latin1_swedish_ci';
The quick and dirty solution
Fuer den Fall, dass man an der collation Sache kein Interesse hat, d.h. es keine Rolle spielt ob das Ö schwedisch ist oder deutsch. In meinem Beispiel ist das der Fall, da es um Postleitzahlen geht, also nur Ziffern im String vorkommen.
alter table postpl convert to character set latin1 collate 'latin1_german1_ci';
Sag etwas dazu: