zoukankan      html  css  js  c++  java
  • 大数据量下数据分页的方式

    SQL Server 2000

    PageCount:一页需要的数据条数

    PageIndex:页索引

     

    方式1

    select top PageCount * from (

    select top PageCount * from (

    select top PageCount*PageIndex  *  from tableName order by ID) as tmp1 order by ID DESC

    ) as tmp2 order by ID

    )

    方式2

    select * from tableName where ID in (

         select top PageCount BillID from (

            select top PageCount*PageIndex ID from tableName order by ID

         ) temp1 order by ID DESC

    ) order by ID

     

    Oracle 9i

    SQL:普通的Select语句

    FromIndex:从…条

    ToIndex:到…条

    通用的方式:

    select * from (

         select row_.*, rownum rownum_ from (
           SQL

    ) row_ where rownum <= toIndex
    ) where rownum_ > fromIndex

     

    有唯一标识符(ID字段)的情况排序

    select * from tableName where ID in(
      select
    ID
    from (
        select rownum rownum_,
    ID
    from (
          select ID from
    tableName order by Code

        ) where rownum <=
    toIndex
      ) where rownum_ >
    fromIndex
    )

  • 相关阅读:
    VC环境OpenSSL编译笔记
    手动造工具TaskJobManage
    Java性能分析工具
    ES77
    Flink消费kafka
    阻塞对列
    C# 超时事件
    毕业前做一件事
    PID控制器——控制网络爬虫速度
    2.5 OpenEuler 中C与汇编的混合编程(选做)
  • 原文地址:https://www.cnblogs.com/Sniper/p/31765.html
Copyright © 2011-2022 走看看