zoukankan      html  css  js  c++  java
  • sql 分页查询

    引用:http://space.itpub.net/26273/viewspace-704021

    初始定义:

    pageSize:每页显示大小

    pageNum:第几页

    Oracle分页:

    minus差分页:

    select * from table where rownum<=pageSize*pageNum minus select * from table where rownum<=(pageSize-1)*pageNum

    例子:

     select * from table where rownum<=10 minus select * from table where rownum<=5

     两个关联表的符合条件记录的交集,是于union作用相反.

    :

     select  *  from  table  where  rownum<=20  

     minus    

     select  *from  table  where  rownum<=10

     

    SQLServer分页:

    select top pageSize*pageNum from table where id not in(select top (pageSize-1)*pageNum id from table );

    例子

    select top 5 * from table where id not in(select top 0 id from table);

     

    MySQL分页:

    select * from table limit (pageSize-1)*pageNum,pageSize*pageNum;

    例子:

    select * from table limit 0,5;

  • 相关阅读:
    推箱子
    为textarea增加maxlength属性(转)
    validate
    keypress
    Knockout
    &amp; replace &
    银联参数
    chinapay
    model binding
    JSON.stringify
  • 原文地址:https://www.cnblogs.com/sode/p/2361576.html
Copyright © 2011-2022 走看看