Stefan Frederiksen
Stefan Frederiksen

Reputation: 135

Select records with two dates with 3 months or less between

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

Answers (1)

Barry
Barry

Reputation: 3733

Use DATEDIFF like

WHERE
    DATEDIFF(m,Date2,Date1) <= 3

m is specifying that the difference must be calculated in months.

Upvotes: 2

Related Questions