Home  >  Article  >  Backend Development  >  zend framework怎么进行三表查询

zend framework怎么进行三表查询

WBOY
WBOYOriginal
2016-06-13 10:37:48871browse

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'));

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn