Home Forums SQL Server 2005 T-SQL (SS2K5) finding gaps between termination date and next enrollment date and filter by gap >= 45 days for year 2013 RE: finding gaps between termination date and next enrollment date and filter by gap >= 45 days for year 2013

  • Hi autoexcrement!

    First, I would like to say thank you for your time on this. 🙂

    Unfortunately, when running it against the live data, this doesn't work as expected for the following scenario:

    UNIVERSALMEMBERID ENROLLMENTDATE TERMINATIONDATE

    1992ANNA 3/1/2012 4/30/2012

    1992ANNA 7/1/2012 3/24/2013

    1992ANNA 3/25/2013 7/31/2013

    1992ANNA 8/1/2013 12/31/2013

    I probably need to isolate the records are within the measurement year, 2013.

    How can I go about doing that too, so that the 45 day gap is only checked during 2013 and not previously as I stated in my explanation?

    Thanks a lot again!

    Tammy