LIMIT 10..20 in SQL Server

后端 未结 15 2541
礼貌的吻别
礼貌的吻别 2020-11-22 11:21

I\'m trying to do something like :

SELECT * FROM table LIMIT 10,20

or

SELECT * FROM table LIMIT 10 OFFSET 10
15条回答
  •  庸人自扰
    2020-11-22 12:00

    How about this?

    SET ROWCOUNT 10 
    
    SELECT TOP 20 *
    FROM sys.databases
    ORDER BY database_id DESC
    

    It gives you the last 10 rows of the first 20 rows. One drawback is that the order is reversed, but, at least it's easy to remember.

提交回复
热议问题