#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Pulling Records 12-18 months old from todays date


    I am trying to query records 12-18 months and 18-24 months old from todays date. I have had very little luck and was hoping for a push in the right direction. Thanks!
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    Originally Posted by JohnnyInterwebs
    ... hoping for a push in the right direction. Thanks!
    DateAdd() and GetDate() functions
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0
    Originally Posted by r937
    DateAdd() and GetDate() functions
    BETWEEN DATEADD(m, - 12, GETDATE()) AND DATEADD(m, - 18, GETDATE()) ?
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    Originally Posted by JohnnyInterwebs
    BETWEEN DATEADD(m, - 12, GETDATE()) AND DATEADD(m, - 18, GETDATE()) ?
    nope, sorry

    it's gotta be the other way around

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0
    Bless you sir.
  10. #6
  11. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    Originally Posted by JohnnyInterwebs
    Bless you sir.
    i sneezed?

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo