在同一张表中查询mysql 的被删除的所有Id,就是不连续的Id。
select Id+1 as Id from youtable a where not exists(select * from youtable b where b.Id = a.Id + 1) and Id < (select MAX(Id) from youtable)
在同一张表中查询mysql 的被删除的所有Id,就是不连续的Id。
select Id+1 as Id from youtable a where not exists(select * from youtable b where b.Id = a.Id + 1) and Id < (select MAX(Id) from youtable)