Chinaunix首页 | 论坛 | 博客
  • 博客访问: 403517
  • 博文数量: 79
  • 博客积分: 4010
  • 博客等级: 上校
  • 技术积分: 897
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-10 23:22
文章分类

全部博文(79)

文章存档

2011年(1)

2010年(6)

2009年(39)

2008年(33)

我的朋友

分类: 数据库开发技术

2009-12-09 09:41:06

一:Oracle
select * from (select rownum,name from table where rownum <=endIndex )
where rownum > startIndex
 
 
select * from table where rownum > startIndex and rownum <=endIndex (默认升序排列)
 
取查询结果中的startIndex 至 endIndex 的记录

二:DB2
DB2分页查询
SELECT * FROM (Select 字段1,字段2,字段3,rownumber() over(ORDER BY 排序用的列名 ASC) AS rn from 表名) AS a1 WHERE a1.rn BETWEEN 10 AND 20

以上表示提取第10到20的纪录

select * from (select rownumber() over(order by id asc ) as rowid from table where rowid <=endIndex )
where rowid > startIndex

三:MySQL
select   *   from   table   limit   start, pageNum  
 
pageNum:记录数
阅读(2133) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-07-16 18:43:08

KK娱乐视频网,快乐齐分享 www.yulekk.com 搞笑视频,动漫视频,美女写真,靓丽车模,美女翻唱,精彩MV,经典DV