I digress. In order to select 10 records from some table at random, try this:
Now for my homework, I should find out just how random this is. There's a whole slew of statistical tests I can run to gauge the randomness of pseudorandom number generator such as the Chi-square Test, Serial Correlation Coefficient, and 2-D Random Walk Test to name a few.SELECT TOP 10 * FROM someTable ORDER By NEWID()
IMPORTANT: Please note that this will NOT work in SQL 7 on NT4 because the NEWID() function there generates sequential results
No comments:
Post a Comment