• I believe that the formula to calculate the date is a little bit wrong.

    Here's an example according to what I understood:

    DECLARE @Date datetime= GETDATE()

    SELECT DATEADD(MM, DATEDIFF(MM, '19010101', @Date), '19000101'), --Using one year difference

    DATEADD(MM, DATEDIFF(MM, '19000101', @Date) - 12, '19000101'), --Subtracting one year with same dates

    DATEADD(MM, DATEDIFF(MM, 0, @Date) - 12, 0) --Substracting one year using integers instead of dates

    Obviously, you'll have to use one of these formulas in your WHERE clause. If you have any more questions, feel free to ask.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2