>* Assumes V. 7 for RW cursor, but can emulate in prev versions. > >SELECT cCodes, .F. AS lSelected ; > FROM BigTable ; > INTO CURSOR UniqueCodes readwrite ; > GROUP BY cCodes > >lnCodes = _Tally > >SELECT UniqueCodes > >* This approach to using RAND() will give randomized numbers, but >* the same sequence each time it is run (this is helpful for testing >* to determine that changes in execution speed are due to algorithm >* changes rather than the distribution of the values). > >* If you want a different series between runs, you can issue a >* preliminary call to RAND (-1) which will seed with a value >* from the system time clock. For that, uncomment the line below > >* = RAND (-1) > >lnSelected = 0 >DO WHILE lnSelected < 110 > GO lnCodes * RAND () + 1 > IF NOT lSelected > REPLACE lSelected WITH .T. > lnSelected = lnSelected + 1 > ENDIF >ENDFOR > >SELECT cCodes ; > FROM UniqueCodes ; > WHERE lSelected ; > INTO CURSOR SelectedCodes > >I'd rather create cursor SelectedCodes and insert records into it from within the Do While lnSelected<110 loop, so you wouldn't have to run a select against a long table in the end. But other than that, this seems to be the ticket.