• I think there is a problem with your sample data.

    There is at least one end date that occurs prior to the start date for the associated record.

    Additionally, since the end dates are inconsistent in duration from the start, the query would be to write a query with those dates as static values.

    Otherwise, you should be recording the end dates in a table along with the start date.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events