I think this might be clearer if you moved the subselect into the join clause defining LastEvent rather than in the result set.