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:

 

评分:0

我来说两句

日历

« 2024-05-10  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 12562
  • 日志数: 26
  • 图片数: 1
  • 建立时间: 2007-07-04
  • 更新时间: 2007-11-08

RSS订阅

Open Toolbar