在MySQL,我新建一个视图,命令如下:
create or replace view abc as select xmmc from project where xmmc like '%地铁%';
可生成视图abc,但select * from abc; 时会出现以下错误:
ERROR 1267 (HY000): Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'
解决方法如下:
create or replace view abc as select xmmc from project where xmmc like convert('%地铁%' using gbk);
这样,select生成的视图abc, 就没有出现以上错误了。