Bug #10590: Retrieving Random Rows
| From: | marty at webmayhem dot net dot SPAMmeNOT | Date: | Tue, 01 May 2001 21:25:29 +0000 |
| Subject: | Bug #10590: Retrieving Random Rows | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53242@lists.php.net to get a copy of this message | ||
From: marty@webmayhem.net.SPAMmeNOT
Operating system: Linux
PHP version: 4.0.5
PHP Bug Type: MySQL related
Bug description: Retrieving Random Rows
in response to some of the user contributed notes on the 'rand()' function page, a good
way to pull a randmon row from a MySql database ( < ver 3.23 ) is:
SELECT field, field*rand() AS ran FROM table ORDER BY ran LIMIT 1
hope it helps.
--
Edit Bug report at: http://bugs.php.net/?id=10590&edit=1