List:General Discussion« Previous MessageNext Message »
From:Brent Baisley Date:December 6 2008 4:34pm
Subject:Re: Randomize by Score and DESC
View as plain text  
That's because RAND() is a decimal (0.37689672).  Try score*RAND().

Brent Baisley

On Nov 30, 2008, at 2:03 AM, sangprabv wrote:

> Hi,
> Thans for the reply, I have tried it but I don't see the RAND() to be
> work. This list is always the same. TIA
>
>
> Willy
>
>
> -----Original Message-----
> From: mos <mos99@stripped>
> To: sangprabv <sangprabv@stripped>, mysql@stripped
> Subject: Re: Randomize by Score and DESC
> Date: Sat, 29 Nov 2008 13:05:09 -0600
> Mailer: QUALCOMM Windows Eudora Version 6.0.0.22
>
> At 09:15 AM 11/29/2008, sangprabv wrote:
>> Hi,
>> I have a query like this "SELECT * FROM table ORDER BY score DESC,
>> RAND()" The aim is to randomize the result by score with descending
>> order. But it doesn't work. What missed here? TIA.
>>
>>
>> Willy
>
>
> Willy,
>       That is because you are ordering by Score then Rand. If Score  
> is an
> integer, try
>
>> SELECT * FROM table ORDER BY score+RAND() DESC
>
>
> This will randomize the higher scores first, followed by the lower  
> scores etc..
>
>
>
> Mike
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>

Thread
Randomize by Score and DESCsangprabv29 Nov
  • Re: Randomize by Score and DESCmos29 Nov
    • Re: Randomize by Score and DESCsangprabv30 Nov
      • Re: Randomize by Score and DESCBrent Baisley6 Dec
        • RE: Randomize by Score and DESCJerry Schwartz8 Dec