Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting 10 records randomly
Message
De
04/01/1998 01:42:56
 
 
À
04/01/1998 00:29:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00069291
Message ID:
00069315
Vues:
42
>>
>>select * from your table into cursor tmp
>>for i=1 to 10
>>  lnRecno = int(rand()*_tally)
>>  go lnRecno
>>  save the record somewhere
>>endfor
>>
>>It's not the best technique, it's my way ;)
>
>To have success with this, you'll have to make sure a filter is not enabled. I did this by putting another field called .T.
>
>Also, as I pointed to Nick, we need to make sure we do not select the same record twice.
>
>IAC, this is about the same as I did. In my case, I wanted to be able to use a INLIST command to get the entire result from a final SQL.

It's not at all the same thing. You select one record randomly and take the following 9 records. Vladimir's code selects 10 times randomly, which means the records will not be in the sequence they are in the cursor (except a very small probability).

Vlad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform