Sql语句求最小可用id

数据库 发布日期:2026/10/9 浏览次数:1

正在浏览:Sql语句求最小可用id
select id from test a where not exists 
( 
        select 1 from test where id=a.id+1 
) 
order by id 
缺点,不从1开始计算。