_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › OffsetAndFetch

蠏碁 蟆朱. れ 豌 10螳 row 蟆郁骸 讌 螻, 11~ 15蟾讌 5螳 Row襯 襴危.
select productid, name    
from adventureworks.production.product
order by name 
offset 10 rows
fetch next 5 rows only

讀, れ 蟆郁骸螳 螳.
select productid, name 
from ( 
select row_number() over(order by name) as rowid, productid, name 
from adventureworks.production.product 
) x 
where rowid between 11 and 15 
order by rowid 

豌 5螳 row襯 螳語.
select productid, name    
from adventureworks.production.product
order by name 
--offset 10 rows
fetch first 5 rows only

企一朱 覲 螳ロ.
use AdventureWorks
go

declare @numberofrows int = 10 -- number of rows you want on a page
declare @desiredpagenumber int = 5 -- page number

select *
from(
    select rownum = row_number() over (order by employeeid), *
    from humanresources.employee
) as a
where rownum > (@numberofrows * (@desiredpagenumber - 1)) 
and rownum <= (@numberofrows * (@desiredpagenumber - 1)) + @numberofrows
order by employeeid

select *
from humanresources.employee
order by employeeid
    offset (@numberofrows * (@desiredpagenumber - 1)) rows
fetch next @numberofrows rows only;

蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

觜襯 襷朱 蟇語願 蟆 蟆 觜襯 螳 譴 一一 蟷 蟇語 譴 蟲郁企. (伎)