7

An error occurred Application error Exception information:

Message: Select query cannot join with another table This is my code:

<?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;
    }
}

I use Zend Framework 1 error

1
  • 3
    $select->setIntegrityCheck(false); add this line (from the below answer)
    – almaruf
    Jul 28, 2015 at 16:00

1 Answer 1

25
<?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;
    }

}

Solved by adding ->setIntegrityCheck(false) ! =)

An explanation of why this helps is found at this question/answer

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.