summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-05-26 09:09:37 +0200
committerAndrey Andreev <narf@devilix.net>2016-05-26 09:09:37 +0200
commite84a1f5814cc1c6dcfb20ab768e394720d42741b (patch)
tree17408a5ffd4d4b628cf4292ad900476df2f6f239 /system/database
parentc0d1b651fb44742711180465a6b677b1cf538137 (diff)
Fix #4647
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_query_builder.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index c862d937d..84346a6ed 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1395,7 +1395,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$this->qb_orderby = NULL;
}
- $result = ($this->qb_distinct === TRUE)
+ $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby))
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));