algo como :
Código PHP:
Ver original//$db is an instance of Zend_Db_Adapter_Abstract
$select = $db->select();
$select->from(array('p' => 'person'), array('person_id', 'name', 'dob')) ->join(array('pa' => 'Person_Address'), 'pa.person_id = p.person_id', array()) ->join(array('a' => 'Address'), 'a.address_id = pa.address_id', array('address_id', 'street', 'city', 'state', 'country'));
$db->fetchRow($select);
echo $select; //prints SQL
No te sirve??
Código PHP:
Ver original<?php
// Given that $dbAdapter is an instance of Zend\Db\Adapter\Adapter
use Zend\Db\Sql\Select();
use Zend\Db\ResultSet\ResultSet();
$select = new Select();
$select->from('album')
->columns(array('album.*', 'a_name' => 'artist.name')) ->join('artist', 'album.artist_id' = 'artist.id');
$statement = $dbAdapter->createStatement();
$select->prepareStatement($dbAdapter, $statement);
$driverResult = $statment->execute();
$resultset = new ResultSet();
$resultset->setDataSource($driverResult);
foreach ($resultset as $row) {
// $row is an ArrayObject
}