首先在zd1和zd2上建立索引
Select [texts] from [tables] where (zd1<23456 and zd2>23456) or (zd1< 13567 and zd2>13567) or (zd1<67543 and zd2>67543) ......
上面这样只能在输出的时候按顺序对比排序
Select [texts] from [tables] where (zd1<23456 and zd2>23456)
union
Select [texts] from [tables] where (zd1<13567 and zd2>13567 )
union
Select [texts] from [tables] where (zd1<67543 and zd2>67543)
这样可以直接按顺序输出.但不知道效率怎样..
sql="select * from tables where zd1 in ("&A&")" '先把这些数据全找出来
rs.open sql,conn,1,1
arr=Split(A,",")
for each num in arr '再按A里的顺序显示
rs.movefirst
do
if rs("zd1")=cint(num) then
response.write rs("zd1")&"对应的文字是"&rs("texts")
Exit Do
end if
loop
next
这种方法已经试过了,可以的
方法一,(zd2大于等于23456的按zd2升序第一条记录)
SELECT TOP 1 *
FROM tables
WHERE zd2 >= 23456
ORDER BY zd2
方法二,(zd1小于等于23456的按zd1降序第一条记录)
SELECT TOP 1 *
FROM tables
WHERE zd1 <= 23456
ORDER BY zd1 DESC
从publish 表中取出第 n 条到第 m 条的记录:
SELECT TOP m-n+1 *
FROM publish
WHERE (id NOT IN
(SELECT TOP n-1 id
FROM publish))
SELECT TOP 页大小 *
FROM Table1
WHERE not exists
(select * from (select top (页大小*页数) * from table1 order by id) b where b.id=a.id )
order by id
可惜我也不会,只能帮顶。
楼主的意思应该是一次性从百万条数据库中(形式如下)
10000 20000 文字一
21000 30000 文字二
31000 40000 文字三
41000 50000 文字四
51000 60000 文字五
61000 70000 文字六
查询到大于或等于下面这个数组的单个数的记录啊:
23456,13567,67543...