我认为您可以使用这样的查询:
SELECt BookNo, ISNULL(LEAD(prev) OVER (ORDER BY BookNo) , (SELECT MAX(BookNo) FROM yourTable)) As toConFROM ( SELECt *, LAG(BookNo) OVER (ORDER BY BookNo) prev, BookNo - LAG(BookNo) OVER (ORDER BY BookNo) diff FROM yourTable) dtWHERe (ISNULL(diff, 0) <> 1);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)