Reputation: 135
How can I make a select Query in SQL where I only want records that has 3 or less months between each other?
Date1 and Date2 column in datetime format: 26-06-2014 00:00:00
Upvotes: 0
Views: 939
Reputation: 3733
Use DATEDIFF
like
WHERE
DATEDIFF(m,Date2,Date1) <= 3
m
is specifying that the difference must be calculated in months.
Upvotes: 2