Mysql获取缺失的不连续height区间

主要SQL语句为: Select height +1 as start, (select min(height)-1 from block as C where C.height> A.height) as end from block as A where not exists ( select * from block as B where A.height +1 = B.height) and height < (select max(height) from block) order by start

posted @ 2020-12-09 16:52  Mr.zzz  阅读(23)  评论(0编辑  收藏  举报