In Re: Selecting records with the highest value no greater than x, <[EMAIL PROTECTED]> wrote: > >IMO, there is one, if I did understand the question correctly: > >SELECT * FROM NEWS WHERE RATING <= 4 ORDER BY RATING DESC, RAND() LIMIT 1; > >This give back a random news entry of the highest score available, but >smaller than 5.
It just gives back a random news story, as it is logically identical to SELECT * FROM NEWS WHERE RATING <= 4 ORDER BY RAND() LIMIT 1; You would need a 'non-uniform' random function for your version to work. Thanks for the user variable URL. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php