SQL-查询语句
上一篇 /
下一篇 2007-07-13 14:00:51
1、如何查询第xxx行数据?
1)假设id是主键:
select *
from (select top xxx * from yourtable) aa
where
not exists(select 1
from (select top xxx-1 * from yourtable) bb
where aa.id=bb.id)
“select 1 from table where id=condition”:
判断是否有符合条件的数据。“Select 1”要比“Select *”速度快。结果集倒是没有什么实际的意义。
2)如果使用游标也是可以的:
fetch absolute [number] from [cursor_name]
行数为绝对行数
收藏
举报
TAG: