归类MySQL错误的非法组合?(Illegal mix of collations mysql er

2019-10-28 15:49发布

我使用geoloaction找到用户的当前位置,它返回的XML数据

<geonames>
    <geoname>
        <toponymName>Gulbahar</toponymName>
        <name>Golīmar</name>
        <lat>24.8922</lat>
        <lng>67.0287</lng>
        <geonameId>1346867</geonameId>
        <countryCode>PK</countryCode>
        <countryName>Pakistan</countryName>
        <fcl>P</fcl>
        <fcode>PPLX</fcode>
        <distance>0.14608</distance>
    </geoname>
</geonames>

现在我想<name>Golīmar</name>其中有一个特殊字符,这个名字我必须运行查询,除了这样一来获取更多的结果,但的基础上,它会产生某种核对错误

SELECT DISTINCT country
FROM   propertydetails
WHERE  country NOT IN ( "Golīmar" )

错误:归类(latin1_swedish_ci,隐含的)AND(utf8_general_ci,COERCIBLE)操作的非法搭配

我见过很多栈POS但无法找到一个方法来解决

Answer 1:

你的桌子整理和您的连接核对不匹配不够紧密,使查询工作。 确保它们都是一样的,最好utf8_general_ci



Answer 2:

我已经解决了我的上述问题

SELECT DISTINCT country
FROM   propertydetails
WHERE  country NOT IN ( _latin1 "Golīmar" )

和字符集和两个连接和表的排序规则latin1latin1_swedish_ci



文章来源: Illegal mix of collations mysql error?