Return to Snippet

Revision: 18476
at September 30, 2009 15:09 by BFTrick


Initial Code
SELECT * FROM Table ORDER BY Rand( ) * ( 1 / Weight )

Initial URL


Initial Description
Must have a field named Weight.  The more Weight the more often the record is selected.  Weight should be an integer between 1 and 10.

Initial Title
Get random record based on weight

Initial Tags
mysql, query

Initial Language
MySQL