From 94f85972714fc8d52c190012a42dfd926bab5c97 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 13 Nov 2014 16:34:27 +0100 Subject: [PATCH] Add existing GROUPBYs to count queries --- library/Icinga/Data/Db/DbQuery.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);