Home  >  Article  >  Backend Development  >  mysql如何找出id不连续的值?

mysql如何找出id不连续的值?

WBOY
WBOYOriginal
2016-06-06 20:14:071451browse

我的id是自增的,有删除记录,现在我想把不连续的那些id给找出来。

回复内容:

我的id是自增的,有删除记录,现在我想把不连续的那些id给找出来。

删除的时候,最好加个字段表示状态,被删除delete设置为1,默认为0,这样id不会断掉,第一个办法不错

可以进行其他数据操作吗?如果可以的话就获取数据库最后一行然后产生一个等高的数据表,然后join然后isnull判断一下就差不多可以了

问问题具体一点呗,并且适当给出场景

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn