Thinking in Mobile

学海无涯乐作舟

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  0 Posts :: 26 Stories :: 1 Comments :: 0 Trackbacks
分页语句:
select * from (select * from (select * from user order by userName) 
where rownum <= 20where rownum >=1
在这里,如果排序字段userName是唯一的则不会出现问题,否则就会出现重复记录的问题。

解决办法是,如果不能确定排序字段是唯一的,必须添加另外一个排序字段,该字段最好是唯一索引键,如:
select * from (select * from (select * from user order by userName, userId
where rownum <= 20where rownum >=1
posted on 2008-11-06 13:07 W.Y.H 阅读(641) 评论(0)  编辑  收藏 所属分类: Oracle

只有注册用户登录后才能发表评论。


网站导航: