What they are saying is basically adding a column to your query that will be
a random string (rand or newid shown) and then order by this column and you
should have a list created that is quite random in nature. (though rand()
doesn't appear to work that well)

fast and straight forward and you don't have to worry about doing iterations
and not selecting the same row.

never had a need like this so I have been playing with it myself.
interesting.

-----Original Message-----
From: Jeff Small [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 02, 2007 9:45
To: CF-Talk
Subject: Re: How to Random Pick records from a 10k record table via SQL

> Just selecte top 20 like russ said and order by rand() instead of 
> newId()

Correct me if I'm wrong, by all means, but selecting the "top 20" from
10,000 records is about as far from "random" as you can be, isn't it?

Won't you have to:
1. randomly select a record with some kind of rand() function of your
choosing. (either your SQL or CF) 2. check to ensure that you haven't
already selected that record 3. if duplicate entry, go back to 1 4. repeat
until 20 records are selected 5. stop

I mean, it's a little more complicated to *really* randomly select 20
records from 10,000, but it's certainly not hard with some kind of iteration
over that process, right? 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274313
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to