public function SelectQuery_sqlsrv::orderRandom in Drupal driver for SQL Server and SQL Azure 7
Same name and namespace in other branches
- 7.3 sqlsrv/select.inc \SelectQuery_sqlsrv::orderRandom()
- 7.2 sqlsrv/select.inc \SelectQuery_sqlsrv::orderRandom()
Override of SelectQuery::orderRandom() for SQL Server.
It seems that sorting by RAND() doesn't actually work, this is a less then elegant workaround.
@status tested
Overrides SelectQuery::orderRandom
File
- sqlsrv/
select.inc, line 190
Class
Code
public function orderRandom() {
$alias = $this
->addExpression('NEWID()', 'random_field');
$this
->orderBy($alias);
return $this;
}