天天看點

mysql根據id分頁_MSSQL根據ID進行分頁實作方法

alter procedure [a0919194122].[dnt_getappinvitelist]

@uid int,

@pageindex int,

@pagesize int

as

declare @startrow int,

@endrow int

set @startrow = (@pageindex - 1) * @pagesize

if @pageindex = 1

begin

exec(

'select top '[email protected]+' [id],[typename],[appid],[type],[fromuid],[touid],[myml],[datetime],[hash] from [dnt_myinvite] where [touid]='[email protected]+' order by [id] desc'

)

end

else

begin

exec('

select

top '[email protected]+'

[id],[typename],[appid],[type],[fromuid],[touid],[myml],[datetime],[hash]

from [dnt_myinvite]

where [touid]='[email protected]+'

and [id] < (select min([id]) from (select top '[email protected]+' [id]

from [dnt_myinvite]

where [touid]='[email protected]+'

order by [id] desc

) as t

)

order by [id] desc

')

end

如您對本文有疑問或者有任何想說的,請點選進行留言回複,萬千網友為您解惑!