SQLTeam.com | Weblogs | Forums

How to Filter due date by all rows with a due date between tomorrow and next 60 days

Hello, I am trying to limit my select statement to return only rows with a due date between tomorrow and 60 days from tomorrow. I can figure out how to select anything due after today but I cannot figure out how to limit it to only dates due within 60 days of tomorrow. I tried a few different options and nothing comes out the way I expect it. I am using this in my WHERE statement to get all due dates after today but need to limit that to only the next 60 days:
WHERE dot.txt_NextDueDate > DATEADD(Day, +1, GETDATE())

I appreciate any help you can offer.

Note, I have converted this Date to varchar in SELECT statement

hi

WHERE
dot.txt_NextDueDate
between DATEADD(dd, 1, GETDATE()) and dateadd(dd,60,getdate())

hope this helps :slight_smile: :slight_smile:

1 Like

Thank you! I tried something similar but must have had something flip flopped here. This worked out great. I even tested it with 90 days and 30 days to see the difference and it did exactly what I needed it to do!