如何在zend框架中构建从Model中连接两个表的查询

时间:2010-12-05 05:10:12

标签: zend-framework

我有两个表'country'和'destination'。我想在Destination Model

中编写一个类似的查询
select destination.*, country.name from destination inner join country on destination.country_id = country.id;

1 个答案:

答案 0 :(得分:1)

尝试:

$this->select('destination.*', 'country.name')->from->('destination')->joinInner('country', '`destination`.`country_id` = `country`.`id`')->setIntegrityCheck(false)->query();