diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php index 50bdecf00..5062c8caf 100644 --- a/library/Icinga/Data/Db/DbQuery.php +++ b/library/Icinga/Data/Db/DbQuery.php @@ -267,7 +267,9 @@ class DbQuery extends SimpleQuery { // TODO: there may be situations where we should clone the "select" $count = $this->dbSelect(); - + if ($this->group) { + $count->group($this->group); + } $this->applyFilterSql($count); if ($this->useSubqueryCount || $this->group) { $count->columns($this->columns);