On Thu, 3 May 2001 20:15:26 +0100, James, Yz ([EMAIL PROTECTED])
wrote:
>Hi Guys,
>
>Does anyone know how to select one field randomnly from a MySQL
table
>against a weighting column in the same row the field is selected
>from?
>
>For example, "SELECT id, url, image FROM table ORDER BY rand() LIMIT
>1".....
i guess you'd just go ' order by rand()*weighting'
- Mark
>And have a column like "weighting" where values between 1 and 100
>are held -
>The larger values making it more likely that they're going to get
>pulled
>out. So say I have three rows in the table, one "weighing" 100, the
>others
>weighing 50, the one weighhing 100 stands a better chance of being
>selected
>randomnly?
>
>I know I've not explained this too well, but hopefully *someone*
>will know
>what I'm rambling on about ;)
>
>Thanks as always,
>
>James.
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: php-list-
>[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]