【发布时间】:2012-10-31 09:15:04
【问题描述】:
我有一个 MySQL 标准查询,我需要将其转换为 Zend_Db_Select,但我无法让它工作。
我收到此错误:
Select query cannot join with another table
这是查询:
// THE COUNTER
$subselect = $this->table->select()->from(
array('x' => 'blog_comments'),
array('x.post_id', new Zend_Db_Expr('count(*) as comments')))
->group('post_id');
// THE TOTAL SELECT
$select->from(array('p' => 'blog_posts'), array('p.*'))
->setIntegrityCheck(false)
->joinLeft(array(
'x' => $subselect,
'x.post_id = p.id',
array()
)
);
如果有人可以转换它,那就太好了,因为我在 select() 模式下需要它,因为我使用 Zend_Pagination。
【问题讨论】:
标签: php mysql zend-framework zend-db-select