Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Last row
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00415642
Message ID:
00419462
Views:
28
>>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).
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform