我尝试以下列方式加入,但我不能,我错了吗?使用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 = $this->fetchAll($select);
return $rows;
答案 0 :(得分:2)
只需设置integrity check
标志
$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 :(得分:0)
问题是,你没有使用正确的对象
$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;