View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 08:49 AM
Walter G.
 
Posts: n/a
Default Re: select rand() returning unexpected results

Okay, that makes sense. Of course the LIMIT won't work the way I need
it, since often I get no results (not to mention the performance hit
I'm taking of having to create 20K rands every time I do a simple
search). Oh well.

Thanks,

Walter

toby wrote:

> I think the short answer is that the WHERE expression, hence RAND(), is
> being independently evaluated for each row.
>
> Try:
> SELECT word FROM nouns ORDER BY RAND() LIMIT 1;
>


Reply With Quote