Php zend 1.12中的内部连接问题

Php zend 1.12中的内部连接问题,php,zend-framework,frameworks,Php,Zend Framework,Frameworks,我试着用下面的方法加入,但是我不能,那我错了吗?使用zend 1.12 SELECT al.nombre, ar.nombre FROM `album` AS al INNER JOIN artista AS ar ON al.artista_id = ar.id 问题是,您没有使用正确的对象 $select = $this->select() ->from(array('al' => 'album'), array('id

我试着用下面的方法加入,但是我不能,那我错了吗?使用zend 1.12

SELECT al.nombre, ar.nombre FROM `album` AS al
INNER JOIN artista AS ar ON al.artista_id = ar.id


问题是,您没有使用正确的对象

$select = $this->select()
         ->from(array('al' => 'album'),
                array('id', 'nombre'))
         ->join(array('ar' => 'artista'),
                'al.artista_id = ar.id');

    $rows = $select ->query()->fetchAll();


    return $rows;

只需设置
完整性检查
标志

$select = $this->select()
     ->setIntegrityCheck(false)
     ->from(array('al' => 'album'),
            array('id', 'nombre'))
     ->join(array('ar' => 'artista'),
            'al.artista_id = ar.id');
$rows = $this->fetchAll($select);


return $rows;

希望它能有所帮助

1-没有任何解释,我几乎没有注意到你和他的帖子之间的变化!2-
$rows=$select->fetchAll($select)不正确。你应该跑1$行=$select->query()->fetchAll()//或2$行=$this->fetchAll($select)//就像他那样感谢我忘了询问对不起,你说的
是什么意思,但我不能
?您是否收到错误消息?抱歉,出现消息:Select query无法与其他表联接
$select = $this->select()
     ->setIntegrityCheck(false)
     ->from(array('al' => 'album'),
            array('id', 'nombre'))
     ->join(array('ar' => 'artista'),
            'al.artista_id = ar.id');
$rows = $this->fetchAll($select);


return $rows;