From 8b95e7e7194ada3e5587bbf3f14af924dfba85ce Mon Sep 17 00:00:00 2001 From: gnat Date: Fri, 13 Apr 2007 19:32:29 +0000 Subject: [PATCH] added RAND orderby --- ...ent overview - Query - ORDER BY - sorting query results.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php b/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php index 0256f2273..f772c4b76 100644 --- a/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php +++ b/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php @@ -19,4 +19,7 @@ $users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address'); $users = $q->from('User u')->leftJoin('u.Email e') ->addOrderby('u.name')->addOrderby('e.address'); + +// grab randomly 10 users +$users = $q->select('u.*, RAND() rand')->from('User u')->limit(10)->orderby('rand DESC');