Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random generation
Message
De
15/05/2005 20:18:31
Ken Dibble
Southern Tier Independence Center
Binghamton, New York, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01013774
Message ID:
01014448
Vues:
21
>>>>The TOP N clause works following way:
>>>>1. All records that match criterias are pulled out into temp result set.
>>>>2. The temp result set is sorted by ORDER BY
>>>>3. The first N records are moved to the final result set. If there're records after Nth with the same sort key, they also included. It means that result cursor can have more than N records.
>>>>
>>>>In this case all 2500 records are pulled out into the temp record set and each gets random value in the rn field. After sorting on the rn field the first 150 records (with the lowest not highest value in the rn field) are copied into resulting cursor. It's unlikely that there would be more than 150 records in the result because of "(RAND() * 1000000)" but in the application you would want to add some code to insure that.
>>>
>>>Spaseebo. Ochen khoroshaw. :-)
>
>Pogalusta. :)

I seldom get opportunities to practice my highschool Russian. And not having the Cyrillic alphabet available kind of puts a crimp in it anyway.

A, nechevo.

>>But, why the lowest values instead of the highest?
>
>>TOP N means get the first N records in the sort order. To get the higest values use ORDER BY rn DESC

Okay, that helps. "TOP" means "first" in the specified sort order, not necessarily "highest" in any sense.

Thanks.

Ken
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform