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

Simple "Where date less than today" query 1

Status
Not open for further replies.

JohnOB

Technical User
Oct 5, 2006
253
GB
I want to write a simple query but am just a learner, and am struggling with what I think is the curdate function.

I want to return values where a date field is less then todays date

I currently have
Code:
select * from TABLE where vacated_date <= curdate

but it is not working.

This field is a datetime field.

Thanks

"Stupid isn't not knowing the answer, it's not asking the question
 

use getdate() instead of curdate

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
Also, if you don't want to include today, you need to remove the "=". In your post you mention that you want less than today's date. So, the syntax should be:

"SELECT * FROM Table WHERE vacated_date < getdate()
 
Also, if you don't want to include today, you need to remove the "=". In your post you mention that you want less than today's date. So, the syntax should be:

"SELECT * FROM Table WHERE vacated_date < getdate()"
That may still include records from today as the GetDate() function will return the current time as well.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top