Pascal,
Would you try this, it might recover performance (it worked) :
select top 1 myfield from mytable order by 1 desc && Descending provides max
PS: This might return multiple rows when there are many with same max value. But IMHO not a big deal :
external array arrMaxDate
select top 1 order_date from orders ;
order by 1 desc ;
into array arrMaxDate
ldMaxDate = iif(type('arrMaxDate')='D',arrMaxDate,{})
Cetin
>Cetin,
>
>Thanks for testing.
>I had already got to the workaround you suggest but indeed performance did drop as the table doesn't have an index on deleted.
>
>Pascal.
>
>>Pascal,
>>YOU'RE RIGHT !!! I could reproduce it if field was of date or datetime datatype.
>>It doesn't behave that way in VFP6 or 7.
>>I'm afraid you should use old workaround :
>>
>>select ... from ... where !deleted() and ...
>>
>>This might make sense to have an index on deleted().
>>Cetin