zoukankan      html  css  js  c++  java
  • 分页[转]


    select top 10 b.* from (select top 20 主键字段,排序字段 from 表名 order by 排序字段 desc) a,表名 b where b.主键字段 = a.主键字段 order by a.排序字段

    10 = 每页记录数

    20 = (当前页 + 1) * 每页记录数


    1。用next()方法,
    选从50-100行
    int CurrentRow = 1;
    int MinRow = 50;
    int MaxRow = 100;
    while(rs.next())
    {
    if (CurrentRow

    {
    CurrentRow++;
    continue;
    }
    }
    2.用absolute(int row)定位
    先定位到50行,然后next();
    3.用sql完成
    SqlServer的语句:select top 50 * from (select top 100 * from sysobjects order by id) as a order by id desc
    Oracle的语句:
    select * from (select rownum r ,* from test) ss
    where ss.r > 50 and ss.r <= 100;
    测试速度 :
    absolute()最慢;定位到10000条以后无法忍受!
    next();前面几条快,越往后越慢!
    SqlServer语句,比next快很多,但也是越往后越慢!
    Oracle语句,最快!几乎不受条数影响!


  • 相关阅读:
    odoo邮箱系统
    运行odoo13,走的odoo12的数据库
    字段`in_group_69`不存在
    odoo库存
    Codeforces 1430E
    AtCoder "Regular Contest 102" D
    AtCoder "Grand Contest 041" E
    ZJNU 2471
    ZJNU 2455
    Codeforces 1426F
  • 原文地址:https://www.cnblogs.com/huqingyu/p/218207.html
Copyright © 2011-2022 走看看