zoukankan      html  css  js  c++  java
  • ruwnumber自定义分页

    一:row_number方法分页

    string Sql="select * from (select row_number() over (order by created) as row_number,* from contents) as T where T.row_number>"+(pagenumber-1)*pagesize+"and T.row_number<="+pagenumber*pagesize:
    其中contents为表名,pagenumber为当前显示的页号,pagesize为每页显示的数据条数!

    =====================================================================================

    二:Sql自定义方式分页

    declare@pageIndexint

    declare@startRowIndexint
    declare@maximumRowsint

    set@pageIndex=5

    set@startRowIndex=0
    set@maximumRows=1000

    set@startRowIndex=(@pageIndex-1)*@maximumRows+1

    select ProductID,ProductName,AuthorNames,ManufacturerName,RowRank
    from (
    select ProductID,ProductName,AuthorNames,ManufacturerName,row_number() over(orderby ProductID) as RowRank
    from Products
    )
    as ProductsWithRowNumbers
    where RowRank >=@startRowIndex
    and RowRank < (@startRowIndex+@maximumRows)
  • 相关阅读:
    LeetCode_Spiral Matrix II
    省选模拟10 题解
    省选模拟9 题解
    省选模拟8 题解
    省选模拟7 题解
    省选模拟6 题解
    省选模拟5 题解
    省选模拟4 题解
    数学专题测试3 题解
    数学专题测试2 题解
  • 原文地址:https://www.cnblogs.com/happygx/p/1957858.html
Copyright © 2011-2022 走看看