mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00: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
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function count( $column = null) {
|
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
|
// Choose a default column
|
||||||
if($column == null) {
|
elseif($column == null) {
|
||||||
if($this->groupby) {
|
if($this->groupby) {
|
||||||
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user