summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-11-04 14:52:16 +0100
committerAndrey Andreev <narf@devilix.net>2015-11-04 14:52:16 +0100
commit939f1a27f3e70170326f6acbc50c0e1c96e52fd3 (patch)
tree2b10dc6d5318e26de42196e0dd6e467e0d575a50 /system/database
parent6afbb3a9f186f912d5105aea704bb58c55931762 (diff)
Fix #4212
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 cf1100d27..7a3d2f594 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1379,7 +1379,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$this->from($table);
}
- $result = ($this->qb_distinct === TRUE)
+ $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_orderby))
? $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')));