Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting 10 records randomly
Message
De
05/01/1998 11:16:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
04/01/1998 11:22:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00069291
Message ID:
00069530
Vues:
42
>>What would be the best technique to select 10 records randomly from a table?
>
>This is how I do it.
>
>
>SELECT TOP 10 Table.field1, RAND() AS Dummy;
> FROM Table;
> ORDER BY 2;
> INTO CURSOR tmpStore
>
This is the perfect solution with an exception. rand() might return the same value for top 10 more than once thus resulting set would be more than ten recs. Sure not a problem just get the first ten recs than.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform