Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
... and then I fell off my chair.
Message
From
04/10/2001 05:00:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/10/2001 03:04:11
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00563467
Message ID:
00563998
Views:
15
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,{}) && or _Tally checking
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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform