mysql random update.. how to do it?
Posted: Sun Mar 29, 2009 4:59 am
a mysql statement
"UPDATE usertable SET user_status='premium', ref_date='$date', referrer='$refname' WHERE user_status!='premium' AND referrer='' LIMIT 1"
always picks the entry that satisfies the condition from the earliest record to later ones. How to randomize this?
Like is a user with the credentials
id user_status referrer
75 standard
(which is the first record to match the conditions)
doesnt get picked but another random one down the line like with an ID 87 gets picked?
"UPDATE usertable SET user_status='premium', ref_date='$date', referrer='$refname' WHERE user_status!='premium' AND referrer='' LIMIT 1"
always picks the entry that satisfies the condition from the earliest record to later ones. How to randomize this?
Like is a user with the credentials
id user_status referrer
75 standard
(which is the first record to match the conditions)
doesnt get picked but another random one down the line like with an ID 87 gets picked?