Row Offset in SQL Server

后端 未结 16 2388
醉酒成梦
醉酒成梦 2020-11-22 05:53

Is there any way in SQL Server to get the results starting at a given offset? For example, in another type of SQL database, it\'s possible to do:

SELECT * FR         


        
16条回答
  •  粉色の甜心
    2020-11-22 06:37

    See my select for paginator

    SELECT TOP @limit * FROM (
       SELECT ROW_NUMBER() OVER (ORDER BY colunx ASC) offset, * FROM (
    
         -- YOU SELECT HERE
         SELECT * FROM mytable
    
    
       ) myquery
    ) paginator
    WHERE offset > @offset
    

    This solves the pagination ;)

提交回复
热议问题