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".....

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: [EMAIL PROTECTED]

Reply via email to