首页 > 数据库 > 文库 > 正文

Sql语句求最小可用id

2020-10-29 21:56:25
字体:大 中 小
来源:转载
供稿:网友
select id from test a where not exists 
( 
        select 1 from test where id=a.id+1 
) 
order by id 
缺点,不从1开始计算。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表