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!

select all records where date is between now and 5 days ago 1

Status
Not open for further replies.

lminmei

Programmer
Feb 1, 2000
111
0
0
US
i have a datestamp field ("datestamp") in my sql table
how would i write a query to return all records that are date stamped between now() and 5 days ago?
 
Code:
select *
from mytable
where datestamp > GETDATE()-5

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
There is no datestamp field type in SQL Server nor is there a now() function. Are you using Mircosoft SQL Server or some other database?

Questions about posting. See faq183-874
 
to answer SQLSister's question... "now()" was only an example of the current date/time, and the "datestamp" field is the name of my field...that's all

thanks dbomrrsm for the help!!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top