I don't agree with Sergey here. He is correct that LOCATE will be Rushmore optimizable, but the Rushmore engine must search the available tags to see if there is an appropriate one to use. It won't automatically use the selected index. I think approach 1 is faster.
But, I am curious, why do you want to get the last value?
>Hi All,
>
>I have a table with an integer field indexed ascending. To retrieve the maximum value of that field, which is the faster approach below:
>
>Approach 1:
>
>USE mydb!table1 IN 0 ORDER field1
>GO BOTTOM
>m.lnMax = table1.field1
>USE IN table1
>
>
>Approach 2:
>
>USE mydb!table1 IN 0 ORDER field1
>CALCULATE MAX(table1.field1) TO m.lnMax
>USE IN table1
>
>
>If one is faster the other, then why?
>
>Any response will be appreciated greatly!
>
>Dawa
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer