php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10590 Retrieving Random Rows
Submitted: 2001-05-01 17:25 UTC Modified: 2001-05-01 17:37 UTC
From: marty at webmayhem dot net dot SPAMmeNOT Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.5 OS: Linux
Private report: No CVE-ID: None
 [2001-05-01 17:25 UTC] marty at webmayhem dot net dot SPAMmeNOT
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-01 17:37 UTC] derick@php.net
Not a PHP bug (but thx for the suggestion)

Jani and Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC