数据库中有一列是NO,怎么样查询它的值是否连续
判断是否从1开始连续的 在线急等
把没有连续的显示出来
------解决方案--------------------
http://topic.csdn.net/t/20040323/21/2877665.html
------解决方案--------------------
- SQL code
1,if(select max(no)-min(no)+1 from tb)=(select count(*) from tb) print '连续'2,if(select max(no)-min(no)+1 from tb)=(select count(*) from tb) and select min(no) from tb)=1 print '从1开始连续'3,select number from master..spt_values where type='p' and not exists(select 1 from tb where no=number) and number<(select MAX(no) from tb)