[Err] 1271 - Illegal mix of collations for operation 'UNION'

报错原因:当使用union或union all时查询出的字段的排序规则不同。

解决方法:

select  column(列名) collate utf8_unicode_ci(排序规则)from table(表名)
union/union all
select  column(列名) collate utf8_unicode_ci(排序规则)from table(表名);

 

posted @ 2021-04-02 20:14  lightbc  阅读(1282)  评论(0编辑  收藏  举报