SQL Server query with pagination and count

前端 未结 5 1008
一生所求
一生所求 2020-12-12 13:54

I want to make a database query with pagination. So, I used a common-table expression and a ranked function to achieve this. Look at the example below.

decla         


        
5条回答
  •  鱼传尺愫
    2020-12-12 14:17

    @pagenumber=5
    @pagesize=5
    

    Create a common table expression and write logic like this

    Between ((@pagenumber-1)*(@pagesize))+1 and (@pagenumber *@pagesize)
    

提交回复
热议问题