diff --git a/lib/sql.js b/lib/sql.js index cea7bea..42df8c9 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -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++) {