Author: MB Software Solutions General Account
Posted: 2009-03-12 at 15:20:44
On Thu, March 12, 2009 3:09 pm, Stephen Russell wrote:
> On Thu, Mar 12, 2009 at 1:58 PM, KAM.covad
> <a_gmail_noSpam@kenmcginnis.com> wrote:
>
>> I have a table with a date field: dDate and thousands of records.
>>
>>
>> The dates are scattered over time including the future. I need to find
>> the record with the max date that is =< required date.
>>
>> How would you do this with sql select and also with Locate?
>>
> ------------------------
>
>
> Select top 1 <column list>
> from yourTable where dDate <= ldDate order by dDate descending
>
> For Fox 7 and higher I believe, maybe you need 8??
Not sure, but I'm pretty sure TOP 1 was in VFP 5/6? That's pretty basic.