Home > Software design >  SQL: calculate if a period between 2 dates equal or less than 3 months
SQL: calculate if a period between 2 dates equal or less than 3 months

Time:11-16

Would you help me, please, to write a T-SQL query which calculates if a period between 2 dates equal or less than 3 months.

Calculation logic: if the first date = 4 April, then 4 July is the last day, then the statement 'equal_or_less_than_3_months' is true.

Exception: if the first date = 31 August, then 30 November is the last day, then the statement 'equal_or_less_than_3_months' is true.

Thank you.

CodePudding user response:

What about :

WHERE END_DATE < DATEADD(month,  3, BEGIN_DATE)
  • Related