
random record selector???
Quote:
> SELECT TOP 100 Orders.OrderID
> FROM Orders
> ORDER BY Rnd([OrderID]);
You have to 'seed' the Rnd function first. Do this by calling
'Randomize' once each time before you run the query.
Quote:
> >The results must be different each time I run it.
> That's not random.
Yes it is.
Quote:
> >And all 100 of the records must be unique (I cant have record 20 show up
> That's not random, either.
Yes it is.
The first assertion is a semantic 'misunderstanding'. The second is either a
semantic error or a logic error: sampling without replacement can be either
random or non-random: the two factors are orthogonal. Whichever, the
query design is definitely clever.
Quote:
> On Fri, 2 Mar 2001 19:32:05 -0500, "Thomas Frohe"
> >I want to select 100 completely random records from a table of 50,000 or so
> >unique records.
> Ok.
> >The results must be different each time I run it.
> That's not random.
> >And all 100 of the records must be unique (I cant have record 20 show up twice).
> That's not random, either.
> Sounds like you want a shuffle algorithm. If you wanted to pick 100
> random rows from Northwind's Orders table, you could use something
> like this:
> SELECT TOP 100 Orders.OrderID
> FROM Orders
> ORDER BY Rnd([OrderID]);
> --
> Mike Sherrill
> Information Management Systems