db: Respect group by for count queries, really
Missed that Johannes introduced DbQuery::getGroup(). refs #9828
This commit is contained in:
parent
60675979bc
commit
528382098e
|
@ -334,8 +334,12 @@ class DbQuery extends SimpleQuery
|
||||||
// TODO: there may be situations where we should clone the "select"
|
// TODO: there may be situations where we should clone the "select"
|
||||||
$count = $this->dbSelect();
|
$count = $this->dbSelect();
|
||||||
$this->applyFilterSql($count);
|
$this->applyFilterSql($count);
|
||||||
if ($this->useSubqueryCount || $this->group) {
|
$group = $this->getGroup();
|
||||||
|
if ($this->useSubqueryCount || $group) {
|
||||||
$count->columns($this->columns);
|
$count->columns($this->columns);
|
||||||
|
if ($group) {
|
||||||
|
$count->group($group);
|
||||||
|
}
|
||||||
$columns = array('cnt' => 'COUNT(*)');
|
$columns = array('cnt' => 'COUNT(*)');
|
||||||
return $this->db->select()->from($count, $columns);
|
return $this->db->select()->from($count, $columns);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue