sry,

scatter name oFipsCodes

----- Original Message ----- 
From: KAM.covad 
To: ProFox Email List 
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. 

Select Top 1 * ;
from oFipsCodes ;
where ;
ccode = lcFips And ;
!EMPTY(dbgdate) AND ;
dbgdate <= ldDate ;
order By dbgdate Descending
scatter name oFipsCodes
nTaxRate = 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 ----- 
From: Stephen Russell 
To: ProFox Email List 
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_nos...@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??

HTH


-- 
Stephen Russell
Sr. Production Systems Programmer
Web and Windows Development
Independent Contractor
Memphis TN

901.246-0159

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/00ee01c9a4cb$fd1555c0$8600a...@w2k3s02
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to