×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simple "Where date less than today" query

Simple "Where date less than today" query

Simple "Where date less than today" query

(OP)
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"

RE: Simple "Where date less than today" query


use getdate() instead of curdate

I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)

RE: Simple "Where date less than today" query

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()"

RE: Simple "Where date less than today" query

Quote:


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,
http://aspnetlibrary.com

Need help finding an answer? Try the Search Facility or read FAQ222-2244: How to get the best answers.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close