Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Last row
Message
De
22/09/2000 13:29:20
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00415642
Message ID:
00419875
Vues:
37
>>>>Bottom in SQL Server terms is a relative term. SQL Server tables are physically ordered based on the a clustered index. If you have a clustered index on a date field, then the last row will be the highest date (assuming it is in ascending order), while the maximum PK may exist in the middle somewhere.
>>>>
>>>>Depending on the order you want you can use the TOP keyword in your SQL statement.
>>>>
>>>>select top 1 * from mytable order by mykey desc
>>>>
>>>>This will give the maximum and it won't involve two queries. My way of thinking would be you would first have to retrieve the maximum key and then query again based on that key. This is done in one step.
>>>>
>>>>HTH.
>>>
>>>Ahh, another strategy that seems workable.
>>>
>>>Thanks,
>>
>>Big problem with TOP 1 on Fox tables. It goes through ALL the records to return you just the one you want. (Kind of an un-optimized search).
>
>The nice thing about SQL Server is it actually uses the index and only returns the first X rows from that index. It doesn't go through the entire table.

Thanks, Larry. That's good to know. Any idea why Fox tables don't just do the same?
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform