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!

Last 12 months

Status
Not open for further replies.

NotSQL

Technical User
May 17, 2005
205
0
0
GB
Im looking to retrieve data for the last 12 months.

Can anyone help with the syntax?
 
Lol, so you want someone to read your mind as well as answer your question?

--------------------
Procrastinate Now!
 
Yeah, sytanx for the last 12 months a bit like this:

dateadd(mm, datediff(mm, 0, getdate())-12, 0)

LOL!!!
 
I think you are on the right track.

Assuming you have a table, and it has a date/time column, than something like this should work:

Code:
SELECT *
FROM <table>
WHERE <date_column> >= dateadd(mm, -12, GetDate())
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top