首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

ASP如何从access中判断NUm字段,连续的三条一样的

2012-03-21 
ASP怎么从access中判断NUm字段,连续的三条一样的?例如从下列数据记录中取出ID为8、9、10和13、14、15的记录?ID

ASP怎么从access中判断NUm字段,连续的三条一样的?
例如从下列数据记录中取出ID为8、9、10和13、14、15的记录?

ID | chk
-------------------
1 0
2 0
3 1
4 1
5 0
6 1
7 0
8 1
9 1
10 1
11 0
12 0
13 1
14 1
15 1
16 1
17 1
18 0
19 1

[解决办法]
select *
from 下列数据记录 a
where exists (select 1 from 下列数据记录 where chk=1 and ID=a.ID+1)
and exists (select 1 from 下列数据记录 where chk=1 and ID=a.ID+2)
and chk=1
[解决办法]
select top 3 * from table where ID>=8 order by id asc
[解决办法]
select * from tb where id in (8,9,10,13,14,15)

热点排行