天道酬勤。。。

SQL-查询语句

上一篇 / 下一篇  2007-07-03 21:26:33 / 天气: 热 / 个人分类:数据库

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-04-11  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 3755
  • 日志数: 8
  • 建立时间: 2006-12-29
  • 更新时间: 2007-07-03

RSS订阅

Open Toolbar