Heim >Backend-Entwicklung >PHP-Tutorial > zend framework怎么进行三表查询
zend framework如何进行三表查询
请教zend framework如何进行三表查询,两表查询小弟试过了可以
$adapater = Zend_Db_Table::getDefaultAdapter();
$select = $adapater->select();
$select->from('course','*');
$select->join('menu','menu.mid=course.categoryid','name');
请教三表查询的问题,希望给位高手解答。
------解决方案--------------------
$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'));