while select statesLog1 notexists join statesLog2 where statesLog2.ObjectId == statesLog1.ObjectId && statesLog2.ChgDate > statesLog1.ChgDate