gpt4 book ai didi

php - 选择查询无法与另一个表连接 - JOIN Zend Framework

转载 作者:可可西里 更新时间:2023-11-01 06:39:06 25 4
gpt4 key购买 nike

发生错误应用程序错误异常信息:

消息:选择查询无法与另一个表连接这是我的代码:

<?php

class Application_Model_DbTable_Seguimientos extends Zend_Db_Table_Abstract {

protected $_name = 'Seguimientos';
public function buscarCaso($cod_beneficiario) {
$consulta = $this->select()

->from(array('seg' => 'Seguimientos'))
->join(array('casos' => 'Asuntos_Estudiantiles'),
'seg.cod_radicado = casos.codigo_radicado')
->where('casos.cod_beneficiario = ?', $cod_beneficiario);

$query = $this->fetchAll($consulta)->toArray();
return $query;
}
}

我使用 Zend Framework 1 error

最佳答案

<?php

class Application_Model_DbTable_Seguimientos extends Zend_Db_Table_Abstract {

protected $_name = 'Seguimientos';

public function buscarCaso($cod_beneficiario) {

$consulta = $this->select()

->from(array('seg' => 'Seguimientos'))
->join(array('casos' => 'Asuntos_Estudiantiles'),
'seg.cod_radicado = casos.codigo_radicado')
->where('casos.cod_beneficiario = ?', $cod_beneficiario)
->setIntegrityCheck(false); // ADD This Line

$query = $this->fetchAll($consulta)->toArray();
return $query;
}

}

通过添加 ->setIntegrityCheck(false) 解决! =)

this question/answer 中可以找到为什么这有帮助的解释。

关于php - 选择查询无法与另一个表连接 - JOIN Zend Framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24590774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com