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

zend framework怎么进行三表查询

WBOY
Release: 2016-06-13 13:19:52
Original
802 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template