diff --git a/lib/sql.js b/lib/sql.js index 7b52bc8..53894a4 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -1186,11 +1186,16 @@ SQLConnector.prototype.buildOrderBy = function(model, order) { } var self = this; var usedConnector = this.dataSource.connector.name; + if (order === 'rand') { if (usedConnector === 'mysql') { return 'ORDER BY RAND()'; - } else if (usedConnector === 'postgres' || usedConnector === 'oracle') { + } else if (usedConnector === 'postgres') { return 'ORDER BY RANDOM()'; + } else if (usedConnector === 'oracle') { + return 'ORDER BY dbms_random.value'; + } else if (usedConnector === 'mssql') { + return 'ORDER BY NEWID()'; } } else { if (typeof order === 'string') {