May 17, 2006 #1 NotSQL Technical User May 17, 2005 205 GB Im looking to retrieve data for the last 12 months. Can anyone help with the syntax?
May 17, 2006 #2 Crowley16 Technical User Jan 21, 2004 6,931 GB Lol, so you want someone to read your mind as well as answer your question? -------------------- Procrastinate Now! Upvote 0 Downvote
Lol, so you want someone to read your mind as well as answer your question? -------------------- Procrastinate Now!
May 17, 2006 Thread starter #3 NotSQL Technical User May 17, 2005 205 GB Yeah, sytanx for the last 12 months a bit like this: dateadd(mm, datediff(mm, 0, getdate())-12, 0) LOL!!! Upvote 0 Downvote
Yeah, sytanx for the last 12 months a bit like this: dateadd(mm, datediff(mm, 0, getdate())-12, 0) LOL!!!
May 17, 2006 #4 TJRTech Programmer Apr 8, 2002 411 US 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()) Upvote 0 Downvote
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())