首页 > 数据库技术 > 详细

数据库的分页

时间:2017-02-17 16:47:11      阅读:222      评论:0      收藏:0      [点我收藏+]

一,MySQL

   基本句式

    select * from tableName where  ...  order by ... limit [n,]m;

    就是查询从第n条数据后的m 条数据。n可由可无。

   子查询的分页方式,提高查询速度

    select * from tableName where id>=

    (select id from tableName where ...orderby... limit n,1) limit m;

 


二, oracle 

   基本句式

    select * from tablename from(select ROWNUM r,t1.* from tablename t1 where

    ROWNUM<=n+m) t2 where t2.r>n;

    select * from (select a.*,ROWNUM r from(select * from tablename)a where ROWNUM<=n+m)

    where a.r>n

数据库的分页

原文:http://www.cnblogs.com/m01qiuping/p/6410354.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!