db: Respect group by for count queries, really

Missed that Johannes introduced DbQuery::getGroup().

refs #9828
This commit is contained in:
Eric Lippmann 2015-08-06 10:46:40 +02:00
parent 60675979bc
commit 528382098e
1 changed files with 5 additions and 1 deletions

View File

@ -334,8 +334,12 @@ class DbQuery extends SimpleQuery
// TODO: there may be situations where we should clone the "select"
$count = $this->dbSelect();
$this->applyFilterSql($count);
if ($this->useSubqueryCount || $this->group) {
$group = $this->getGroup();
if ($this->useSubqueryCount || $group) {
$count->columns($this->columns);
if ($group) {
$count->group($group);
}
$columns = array('cnt' => 'COUNT(*)');
return $this->db->select()->from($count, $columns);
}