Reputation: 313
I have the following sql and need to sort the results in random order. I tried adding ORDER BY RAND() but was unsuccessful. I may be missing the syntax on it.
$items = Goods_Model_Good::findByCop(array(
'where' => new JO_Db_Expr(
'good.id IN (SELECT id
FROM good
WHERE copId LIKE ' . Helper_Db::quote($cop['copId']) .
')')));
Upvotes: 0
Views: 52
Reputation: 95052
In PHP you get an array shuffled with shuffle:
shuffle($items);
Upvotes: 3