select 语句查找数列断代的起始位置,例如 ID:1,2,5,7 ;第一个断点为
3,4 所以起始位置为3,最后应输出 3,6。
答案1: select a.id+1 from Table_1 a
where (a.id+1 not in(select id from Table_1))
and a.id<(select max(id) from Table_1)
答案2:select distinct a.id+1 from Table_1 a,Table_1 b
where (a.id<b.id) and (a.id+1 not in(select id
from Table_1))
答案3: select a.id+1 as id from
Table_1 as a where not exists
(select id from Table_1 where id=a.id+1)
and a.id<(select max(id) from Table_1)