added a proper self join on the attempts table for subsequent and previous attempts