mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG count breaks when having clause defined
This commit is contained in:
parent
e94c2a944e
commit
be10d90cc5
@ -1038,8 +1038,13 @@ class SQLQuery {
|
||||
* @return int
|
||||
*/
|
||||
public function count( $column = null) {
|
||||
// we can't clear the select if we're relying on its output by a HAVING clause
|
||||
if(!empty($this->having)) {
|
||||
$records = $this->execute();
|
||||
return $records->numRecords();
|
||||
}
|
||||
// Choose a default column
|
||||
if($column == null) {
|
||||
elseif($column == null) {
|
||||
if($this->groupby) {
|
||||
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user