March 17, 2008 at 5:14 am
Hi,
I want the condition to check : Where LastDate >= [The date from a year back today.]
Any ideas.
Cheers
March 17, 2008 at 5:16 am
Have a look in Books Online for DATEADD.
March 17, 2008 at 8:10 am
I still don't understand any examples please I would appreciate it thanks
March 17, 2008 at 8:24 am
We're not going to do all the work for you. Have a go at writing the query yourself, and if there's anything in particular you don't understand, please post again.
John
March 17, 2008 at 8:27 am
(SE.LastDate >= DATEADD(m,-12,getdate()) )
Would this get the results from 12months upto today?
March 17, 2008 at 8:31 am
I'll answer the question with a question..:)
What does
SELECT DATEADD(m,-12,getdate())
show you?
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
March 17, 2008 at 8:31 am
Yes, that looks right. If you run SELECT DATEADD(m,-12,getdate()) then you see it returns the date from a year ago. Just one thing to beware of: if your requirement is for everything from 17th March 2007 onwards to be returned (rather than everything from 14:30 on 17th March onwards) then you will need to put an extra bit of logic in to make sure it captures the whole of that day.
John
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply