zoukankan      html  css  js  c++  java
  • 分页sql汇总

    1.oracle数据库分页
    select * from (select a.*,rownum rc from 表名 where rownum<=endrow) a where a.rc>=startrow
     
    2.DB2数据库分页
    Select * from (select rownumber() over() as rc,a.* from (select * from 表名 order by 列名) as a) where rc between startrow and endrow
     
    3.SQL Server 2000数据库分页
    Select top pagesize * from 表名 where 列名 not  in(select top pagesize*page 列名 from  表名 order by 列名) order by 列名
     
    4.SQL Server 2005数据库分页
    Select * from (select 列名,row_搜索number() over(order by  列名1) as 别名from 表名) as t where t.列名1>=startrow and t.列名1<=endrow
     
    5.MySQL数据库分页
    Select * from 表名 limit startrow,pagesize
    (Pagesize为每页显示的记录条数)
     
    6.PostgreSQL数据库分页
    Select * from 表名 limit pagesize,offset startrow
    (Pagesize为每页显示的记录条数.)
     
     7.通用模式select * from (
     select * from tb_student where sid not in(
         select sid from tb_student where rownum<=(currentPage-1)*pageSize)
    ) where rownum <=pageSize;

    sqlserver分页:
    select a.* from  (select *,isnull(punish_amount,0)+isnull(forf_amount,0as amount, row_number() over(order by id) as rownumber from case_info) a 
    where  rownumber > 40 and rownumber <50




  • 相关阅读:
    CSS
    171 Excel Sheet Column Number
    设计模式之组合模式
    设计模式之外观模式
    设计模式之装饰者模式
    设计模式之抽象工厂
    设计模式之工厂方法
    23种设计模式和7大原则-开篇
    设计模式之简单工厂
    每天一个Linux命令:locate(19)
  • 原文地址:https://www.cnblogs.com/duenboa/p/6665403.html
Copyright © 2011-2022 走看看