Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date question??

Status
Not open for further replies.

Holm78

Programmer
Mar 5, 2002
60
0
0
SE
Hi all!!

I work in fox pro 6 and I need help to filter a grid and in a SQL statement.
I have many records with various dates. My wish is to filter the grid so that records 7 days old and 7 days forward are shown. in my head I have this:

set filter to startdate between date()-7 and date()+7

I have no great skills in SQL so I would be pleased if someone could help.

//Michael
 
Michael

In your SQL statement that returns your information you want to have a where clause like that below:

********
SELECT birthdays
FROM mydiary
WHERE birthday > dateadd(d, -7, getdate())
AND birthday < dateadd(d, 7, getdate())
********

-getdate() will return today's date from the system clock
-dateadd will add or remove a certain amount of time to the date in the above case 7 days onto today's date

if you are not using true SQL Server and the above is not supported then post another note with a little more detail

hope this helps
 
If you are working in FoxPro and creating FoxPro queries, post you questions in a FoxPro forum.

forum182: FoxPro (versions 1 through 2.6)


forum184: Visual FoxPro (versions 3.0 and higher)
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains &quot;Suggestions for Getting Quick and Appropriate Answers&quot; to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top