Re: Age old order by rand() issue
- Date: Fri, 2 May 2008 10:37:23 -0700
- From: "Rob Wultsch" <wultsch@xxxxxxxxx>
- Subject: Re: Age old order by rand() issue
On Fri, May 2, 2008 at 6:58 AM, Scott Haneda <talklists@xxxxxxxxxx> wrote:
>
> > I have seen nicer fast random row implement, but that will work.
>
>
> Do you happen to have a snip of it, the one I have seems to lean pretty
> heavy as far as I can tell, and on occasion, though rare, also sends me an
> empty result set.
> --
> Scott
> talklists@xxxxxxxxxx
>
You should not be getting empty results with the second/third query.
The reason you were (probably) previously getting empty results with
the first query was because you were doing the join using USING (aka
=) rather than >= . You were also doing a WHERE clause on that could
have removed the random result.
My only problem with what you are using is that it is more likely to
give a large results than a small one. Take a look at the
http://jan.kneschke.de/projects/mysql/order-by-rand/
You probably do not need this.
If you have a large data set, you probably don't want this.
--
Rob Wultsch
wultsch@xxxxxxxxx
wultsch (aim)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx