Add OrderBy Rand()

This commit is contained in:
loay 2017-04-20 14:25:21 -04:00
parent 5307f68364
commit 8355d803d4
1 changed files with 6 additions and 2 deletions

View File

@ -1185,8 +1185,12 @@ SQLConnector.prototype.buildOrderBy = function(model, order) {
return '';
}
var self = this;
if (typeof order === 'string') {
order = [order];
if (order === 'rand') {
return 'ORDER BY RAND()';
} else {
if (typeof order === 'string') {
order = [order];
}
}
var clauses = [];
for (var i = 0, n = order.length; i < n; i++) {