• The inner join wont work where Id 1 which needs to return a NULL value, based on the sample data provided, so you would need a Left outer join, to the prior record based on Id.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices