主义传呼机和分组

时间:2010-11-24 09:38:07

标签: doctrine paging

当原始查询具有GROUP BY时,我遇到了Doctrine寻呼机的问题。寻呼机将生成此查询:

SELECT COUNT(*) AS num_results FROM event e GROUP BY e.type

这是不正确的,因为原始查询应封装在括号中。它应该是:

SELECT COUNT(*) FROM (SELECT * AS num_results FROM event e GROUP BY e.type)

你对如何解决这个问题有什么建议吗?

1 个答案:

答案 0 :(得分:1)

试试这个:

$table->setAttribute(Doctrine_Core::ATTR_QUERY_LIMIT, Doctrine_Core::LIMIT_ROWS);

http://www.doctrine-project.org/projects/orm/1.2/docs/manual/dql-doctrine-query-language/en