假如现在有不连续的数字[1,2,3,5,6,7,8,10,11,12,15]在test表里的id字段
postfresql可以通过sql:
with recursive tb1 as(
select min(id) as min,max(id) as max,1 as number
from test
union select tb1.min,tb1.max,tb1.number+1
from tb1
where tb1.number<tb1.max
)
select tb1.number
from tb1
left join test as tb2 on tb2.id = tb1.number
where tb2.id is null;
查询出区间里的缺省数字
请问这个功能通过MySQL怎么书写SQL?