原创  Oracle RowNum妙用 收藏

取排序后的前10条记录,注意merchantid是自增长,可能不连续

select * from (select * from merchants order by merchantid asc) where rownum<11;

 

取排序后的第5到第10条记录

select merchantid from (select * from merchants order by merchantid asc) where rownum<=10 minus select merchantid from (select * from merchants order by merchantid asc) where rownum<6;

发表于 @ 2008年08月20日 10:29:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:Ado.Net五个主要对象 | 新一篇:关于B/S和C/S架构的探析

  • 发表评论
  • 评论内容:
  •  
Copyright © vincent0203
Powered by CSDN Blog