数据库中有一列是NO,怎么样查询它的值是否连续
------解决方案--------------------
- SQL code
if exists(select 1 from tb a where no>(select min(no) from tb) and not exists(select 1 from tb where no=a.no-1))select '不连续'else'连续'
------解决方案--------------------
- SQL code
if exists(select 1 from tb group by no having max(no)-min(no)+1=count(*))print '存在'