mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX Fixing order by fields for SS 3.0 in MSSQLDatabase::sqlQueryToString()
This commit is contained in:
parent
c7ae517c99
commit
cb01716d39
@ -1227,7 +1227,8 @@ class MSSQLDatabase extends SS_Database {
|
||||
// If there's a limit and an offset, then we need to do a subselect
|
||||
} else if($limit && $offset) {
|
||||
if($sqlQuery->orderby) {
|
||||
$rowNumber = "ROW_NUMBER() OVER (ORDER BY $sqlQuery->orderby) AS Number";
|
||||
$orderByFields = (method_exists($sqlQuery, 'prepareOrderBy')) ? $sqlQuery->prepareOrderBy() : $sqlQuery->orderby;
|
||||
$rowNumber = "ROW_NUMBER() OVER (ORDER BY $orderByFields) AS Number";
|
||||
} else {
|
||||
$firstCol = reset($sqlQuery->select);
|
||||
$rowNumber = "ROW_NUMBER() OVER (ORDER BY $firstCol) AS Number";
|
||||
|
Loading…
Reference in New Issue
Block a user