Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting 10 records randomly
Message
From
04/01/1998 12:35:01
 
 
To
04/01/1998 11:22:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00069291
Message ID:
00069347
Views:
46
>>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
>
To make sure of not having the same record, I added the NUMERO unique ID field in the RAND().

SELECT TOP 10 NUMERO,RAND()+NUMERO AS Dummy ...
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform