0

In SQL Server, and if we have 2 dates, how to return those records having the first date within 6 months before the second date. For example in the following table:

enter image description here

The output will be the highlighted rows in green.

Please note that I'm not trying to calculate the difference between a date from my table and te current date.

2

1 Answer 1

1

DATEDIFF

select date1,date2
from mytable
where datediff(month,date1,date2) < 7
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.