diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-10-26 11:01:02 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-10-26 11:01:02 +0200 |
commit | b05f506daba5dc954fc8bcae76b4a5f97a7433c1 (patch) | |
tree | b833e8a589aa0750375b5815be3f41952b928ff8 /system | |
parent | 5bf199753617bb9bdd068546da52c949351b5333 (diff) |
Fix issue #59
Diffstat (limited to 'system')
-rw-r--r-- | system/database/DB_query_builder.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index ed00510ac..a3585586e 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -1162,7 +1162,9 @@ abstract class CI_DB_query_builder extends CI_DB_driver { $this->from($table); } - $result = $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); + $result = ($this->qb_distinct === TRUE) + ? $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'))); $this->_reset_select(); if ($result->num_rows() === 0) |