function SelectQuery::orderRandom

Overrides SelectQueryInterface::orderRandom

1 method overrides SelectQuery::orderRandom()
SelectQuery_pgsql::orderRandom in includes/database/pgsql/select.inc
Orders the result set by a random value.

File

includes/database/select.inc, line 1440

Class

SelectQuery
Query builder for SELECT statements.

Code

public function orderRandom() {
    $alias = $this->addExpression('RAND()', 'random_field');
    $this->orderBy($alias);
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.