Delete from YourTable VersionA where VersionA.Time NOT IN ( select MAX( VersionB.Time ) Time from YourTable VersionB where VersionA.UserID = VersionB.UserIDand VersionA.VisitorID = VersionB.VisitorID )
语法可能需要调整,但是应该做到这一点。此外,您可能希望将子查询预查询到其自己的表FIRST中,然后对该结果集运行DELETe FROM。



