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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date query

Status
Not open for further replies.

lcan

Technical User
Joined
Mar 1, 2003
Messages
5
Location
US
How can I get todays date plus 5 previous days to pull in from date/time field?
 
SELECT *
FROM MyTable
WHERE MyTable.MyDate BETWEEN (DATE() - 5) AND DATE(); Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Woops, let's retry that (thinking Oracle)...

SELECT *
FROM MyTable
WHERE MyTable.MyDate BETWEEN DATEADD('d', -5, DATE()) AND DATE(); Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top