sql查询第23条到第69条的记录怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/20 01:03:04
如题
换句话说 就是我想要指定位置的记录 具体要第几条 这个条件是变的 比如也有可能要1到6条 请问这个查询怎么写
在下所求的是sql语句 不是程序如何写 是这种 select top 10 * from 表 where .... 是这种东东 谢谢

to 3楼 要的是指定的位置 不是指定的条件(包括between) 这样说吧 就你写的那个 查出了前10条 我要这10条中的第3条到第6条 是这样的

declare m int,n int
set m=23
set n=69

select identity(int)[aid],table.* into #temp from table

select * from #temp where aid between m and n

<%'''换句话说 就是我想要指定位置的记录 具体要第几条 这个条件是变的 比如也有可能要1到6条 请问这个查询怎么写
''连接与打开数据库我就不写了.
''--------读取-------
dim astar,aend''这2个变量用来记录你说的从第几条开始与结束
astar=23''''想从第几条开始就给多少.
aend=69
if rs.recordcount<=0 then
response.write "nothing to show!"
response.end()
else
if astar>1 and astar<aend then
for i=1 to astar-1
rs.movenext
next
end if
'''以下开始显示你要的记录.
for i=astar to aend
''-=-------------
''这里写显示内容.
''-----------------
rs.movenext
next
end if
%>

i=0
sql="select to 70 ..."
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
i=i+1