Author: KAM.covad
Posted: 2009-03-14 at 13:40:36
sry,
scatter name oFipsCodes
----- Original Message -----=20
From: KAM.covad=20
To: ProFox Email List=20
Sent: Saturday, March 14, 2009 10:15 AM
Subject: Re: VFP9 SP1 question for sql guru
This turned out to be the best for me. Simple, quick and works for all =
dates tested.=20
Select Top 1 * ;
from oFipsCodes ;
where ;
ccode =3D lcFips And ;
!EMPTY(dbgdate) AND ;
dbgdate <=3D ldDate ;
order By dbgdate Descending
scatter name oFipsCodes
nTaxRate =3D oFipsCodes.nTax
This is useful since many counties in California are increasing their =
sales taxes on 4/1. This allows us to enter the new tax rate now and =
have it automatically apply for transactions beginning with 4/1.
----- Original Message -----=20
From: Stephen Russell=20
To: ProFox Email List=20
Sent: Thursday, March 12, 2009 12:09 PM
Subject: Re: VFP9 SP1 question for sql guru
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 =3D< required date.
>
> How would you do this with sql select and also with Locate?
------------------------
Select top 1 <column list>
from yourTable
where dDate <=3D ldDate
order by dDate descending
For Fox 7 and higher I believe, maybe you need 8??
HTH
--=20
Stephen Russell
Sr. Production Systems Programmer
Web and Windows Development
Independent Contractor
Memphis TN
901.246-0159
[excessive quoting removed by server]