Reputation: 117
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:
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.
Upvotes: 0
Views: 70
Reputation: 4824
DATEDIFF
select date1,date2
from mytable
where datediff(month,date1,date2) < 7
Upvotes: 1