本文介绍了MySQL-操作'UNION'的排序规则(utf8_general_ci,COERCIBLE)和(latin1_swedish_ci,IMPLICIT)的非法混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何一劳永逸地解决该错误?我只希望能够在MySQL中进行联合.

How do I fix that error once and for all? I just want to be able to do unions in MySQL.

(我正在寻找一种捷径,例如一种使MySQL忽略该问题或做出最佳猜测的选择,而不是希望更改100多个表的排序规则……至少今天不是这样)

(I'm looking for a shortcut, like an option to make MySQL ignore that issue or take it's best guess, not looking to change collations on 100s of tables ... at least not today)

推荐答案

不确定mySQL,但是在MSSQL中,您可以更改查询的排序规则,例如,如果您有2个具有不同排序规则的表,并且想要将它们联接在一起,或者就像您在板条箱里的情况一样,您可以做到

Not sure about mySQL but in MSSQL you can change the collation in the query so for example if you have 2 tables with different collation and you want to join them or as in you situation crate UNION you can do

select column1 from tableWithProperCollation
union all
select column1 COLLATE SQL_Latin1_General_CP1_CI_AS from tableWithDifferentCollation

当然,SQL_Latin1_General_CP1_CI_AS只是您要转换"为的排序规则的一个示例

Of course SQL_Latin1_General_CP1_CI_AS is just an example of collation you want to "convert" to

这篇关于MySQL-操作'UNION'的排序规则(utf8_general_ci,COERCIBLE)和(latin1_swedish_ci,IMPLICIT)的非法混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 07:15