Search for dates in the same week one year ago

  • I am trying to filter for all records dated in the exact same week one year ago. I know the datepart(week, [date]) returns the week of the year, but I can't figure out how to turn that into a date range to search by. Any ideas?

  • Hey Jordan,

    SQL for this might be something like this:

    SELECT

      *

    FROM

      Some_Dates_Table

    WHERE 

      DATEDIFF(year, someDate, GETDATE() ) = 1 AND 

      DATEPART(week, someDate) = DATEPART(week, GETDATE() )

    JP

  • GENIUS!

    Why didn't I think of that?

    Works like a charm! Thank you very much.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply