“操作“ concat”的排序规则的非法混合”在数据库导入后出现 [英] "Illegal mix of collations for operation 'concat'" appears after data base import

查看:88
本文介绍了“操作“ concat”的排序规则的非法混合”在数据库导入后出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的旧站点中,此问题不存在。但是,在我更改服务器并导入数据库之后,将出现此消息。 PHP版本是5.3,这是代码:

In my old site, this problem does not exist. But after I have changed the server and imported the data base, this message appears. The PHP version is 5.3 and this is the code:

$sql = "SELECT * FROM movcaixa 

    WHERE data BETWEEN '$data1' AND '$data2' AND empresa = $empresa 

    ORDER BY data ASC";
   $resMovCaixa = mysql_query($sql, $cnn) or die('Falha na conexão com o banco de dados');
   $sql = "SELECT cp.id AS codigo, CONCAT('Pagamento ref. a ', des.descricao, ', conforme doc. nº ',  cp.documento) AS hist, DATE_FORMAT(cp.quitacao, '%d/%m/%Y') AS data, cp.valorpago AS vlr, cp.documento AS doc, fr.nome AS forn, des.descricao AS desp 

    FROM contaspagar cp, fornecedor fr, despesa des 

    WHERE cp.fornecedor = fr.id AND cp.despesa = des.id AND cp.quitacao BETWEEN '$data1' AND '$data2' AND empresa = $empresa 

    ORDER BY data ASC";
    $resContasPagar = mysql_query($sql, $cnn) or die(mysql_error($cnn));
    $sql = "SELECT cr.id AS codigo, DATE_FORMAT(cr.quitacao, '%d/%m/%Y') AS data, CONCAT('Recebimento ref. ', cli.nome, ', conforme doc. ', cr.documento) AS hist, cr.valorpago AS vlr, cr.documento AS doc, cs.descricao AS cont 

    FROM contasreceber cr, contratoservico cs, cliente cli 

    WHERE cr.contratoservico = cs.id AND cs.cliente = cli.id AND cr.quitacao BETWEEN '$data1' AND '$data2' AND empresa = $empresa 

    ORDER BY cr.quitacao";

有人可以帮我吗?

推荐答案

检查表的排序规则,然后在CONCAT函数中使用:

Check the collations for the tables, you use inside CONCAT function:


  1. des

  2. cp

  3. cli

  4. cr

  1. des
  2. cp
  3. cli
  4. cr

对所有它们使用相同的排序规则。

Use the same collation for all of them.

这篇关于“操作“ concat”的排序规则的非法混合”在数据库导入后出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆