Skip to content

Commit

Permalink
Merge pull request #6753 from cakephp/issue-6730
Browse files Browse the repository at this point in the history
Fix incorrect default order by clause.
  • Loading branch information
lorenzo committed Jun 8, 2015
2 parents b8e00f5 + f8e8044 commit 9243543
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Database/Dialect/SqlserverDialectTrait.php
Expand Up @@ -99,9 +99,9 @@ public function _version()
protected function _pagingSubquery($original, $limit, $offset)
{
$field = '_cake_paging_._cake_page_rownum_';
$order = $original->clause('order') ?: new OrderByExpression('(SELECT NULL)');

$query = clone $original;
$order = $query->clause('order') ?: new OrderByExpression('NULL');
$query->select([
'_cake_page_rownum_' => new UnaryExpression('ROW_NUMBER() OVER', $order)
])->limit(null)
Expand Down

0 comments on commit 9243543

Please sign in to comment.