mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
* refs #11122: Fixed can not use `orderBy` with aggregate functions like `count`, `max` etc. * Update QueryTest.php
This commit is contained in:
committed by
Dmitry Naumenko
parent
a710345ea7
commit
25e6eb04a5
@ -421,7 +421,13 @@ class Query extends Component implements QueryInterface
|
||||
$this->limit = $limit;
|
||||
$this->offset = $offset;
|
||||
|
||||
if (empty($this->groupBy) && empty($this->having) && empty($this->union) && !$this->distinct) {
|
||||
if (
|
||||
!$this->distinct
|
||||
&& empty($this->groupBy)
|
||||
&& empty($this->having)
|
||||
&& empty($this->union)
|
||||
&& empty($this->orderBy)
|
||||
) {
|
||||
return $command->queryScalar();
|
||||
} else {
|
||||
return (new Query)->select([$selectExpression])
|
||||
|
||||
Reference in New Issue
Block a user