Skip to content

Commit 6743de4

Browse files
committed
Update DB_query_builder.php
Fix count_all_result if QB query contains HAVING clause
1 parent 5db277c commit 6743de4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ForgeIgniter/system/database/DB_query_builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ public function count_all_results($table = '', $reset = TRUE)
14121412
$qb_cache_orderby = $this->qb_cache_orderby;
14131413
$this->qb_orderby = $this->qb_cache_orderby = array();
14141414

1415-
$result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR $this->qb_limit OR $this->qb_offset)
1415+
$result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby) OR ! empty($this->qb_cache_groupby) OR ! empty($this->qb_having) OR $this->qb_limit OR $this->qb_offset)
14161416
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
14171417
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));
14181418

0 commit comments

Comments
 (0)