By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

date comparison

P: n/a
Hey all,

I've got to show records from a table that are 45 days old or newer..
im not quite sure how to do this in SQL ...

Select field from table where date > (todaysdate-45).. as you can
see..clueless lol any help is _greatly_ appreciated

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
One approach is to use the DateAdd function. For example:

date > DateAdd("d", -45, Now())

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Beacher" <be*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hey all,

I've got to show records from a table that are 45 days old or newer..
im not quite sure how to do this in SQL ...

Select field from table where date > (todaysdate-45).. as you can
see..clueless lol any help is _greatly_ appreciated
Nov 13 '05 #2

P: n/a
On 13 Jun 2005 13:48:00 -0700, Beacher wrote:
Hey all,

I've got to show records from a table that are 45 days old or newer..
im not quite sure how to do this in SQL ...

Select field from table where date > (todaysdate-45).. as you can
see..clueless lol any help is _greatly_ appreciated


Either of these will do.

Where [DateField] >= Date()-45
or
Where [DateField] >= DateAdd("d",-45,Date())
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3

P: n/a

try using datediff()

best Regards,
Chandra
http://groups.msn.com/SQLResource/
http://chanduas.blogspot.com/
---------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.