>First, the multiplication and the rounding via INT() are redundant - they reduce the quality of the result without any apparent benefit. Second, there is no guarantee that all values assigned to the field RandSel are unique, and so there could be
more than 20% selected if records with the same RandSel straddle the 20% boundary. One easy fix is augmenting the ORDER statement with the undocument 0 (for the implicit RECNO() 'column').
>
>So, the
augmented Trey Walpole trick should read as follows:
>
>select top 20 percent *, 1.00000000000000 * rand() as RandSel ;
> from finallist ;
> order by RandSel, 0 ;
> into table RandomList
>
>
>P.S.: I just noticed that an unqualified RAND() has a dependency on SET DECIMALS, so some multiplication is indeed necessary. I have augmented the example accordingly. Sorry.
np - works much better.
Insanity: Doing the same thing over and over and expecting different results.