SQL Code for todays date -90 days

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kbaisch
    New Member
    • Mar 2007
    • 19

    SQL Code for todays date -90 days

    I have this code set up but I know the 3rd line is wrong. Could someone please help me on the code for pulling all entries for todays date -90 days? I would really appreciate it and thanks for helping.

    SELECT *
    from view1_4t
    where DOB_ = (getdate()-90)
    GO
  • sandyboy
    New Member
    • May 2007
    • 16

    #2
    Originally posted by kbaisch
    I have this code set up but I know the 3rd line is wrong. Could someone please help me on the code for pulling all entries for todays date -90 days? I would really appreciate it and thanks for helping.

    SELECT *
    from view1_4t
    where DOB_ = (getdate()-90)
    GO

    Try this code

    Select * from view1_4t where dob=dateadd(dd,-90,getdate())

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      You have posted this question in the Articles section. I am moving it to the SQL Server forum.

      ADMIN

      Comment

      Working...