We help IT Professionals succeed at work.

SELECT SPECIFIC NUMBER OF RECORDS VFP

Richard Teasdale
Richard Teasdale used Ask the Experts™
on
Hi:
A smallish question:
I have a table of planned production, one row for each date from today.
I want to extract (either as query or export) only the first 5 rows; being the next 5 working days.
Is there a facility to do this in vfp, please?
I was thinking about a loop that flagged the first 5 rows, then select those flagged- but is there another way?
Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
CaptainCyrilFounder, Software Engineer, Data Scientist

Commented:
dFromDate = DATE()
dToDate = DATE()+5
SELECT * FROM table WHERE date >= dFromDate and date <= dToDate
Richard TeasdaleFinancial Controller

Author

Commented:
Thanks, CaptainCyril.
However we do not work at weekends, or bank holidays etc so selecting the next 5 days will, after tuesday, return saturday/sunday  which are empty.
I am afraid my people need to see all 5 days, even allowing for gaps. Since the actual working dates are fixed as part of the originating database, then the first 5 rows will always be the next 5 days, if you get my drift!
Thanks again.
Founder, Software Engineer, Data Scientist
Commented:
Then you need to get the least 5 days after today.

SELECT TOP 5 date WHERE date > dDateFrom ORDER BY date INTO CURSOR dates
SELECT ... FROM table, dates WHERE table.date = dates.date
Richard TeasdaleFinancial Controller

Author

Commented:
Thank You very much!