-4

我想在表中的前 5 条记录之后选择记录。该表正在使用新记录进行更新。我已经展示了 5 条新记录select top 5 * from table order by ID DESC

现在我想在页面的其他地方显示另外 5 条记录,查询会是什么?

4

2 回答 2

0
WITH tmp AS  
(SELECT ROW_NUMBER() OVER (ORDER BY a.id) AS 'rn', a.* FROM table a)
SELECT * FROM tmp WHERE rn BETWEEN 5 AND 10
于 2013-10-25T13:13:17.447 回答
0
SELECT  *
FROM  [dbo].[4]   
ORDER BY [id] ASC 
OFFSET  5 ROWS 
FETCH NEXT 10 ROWS ONLY
于 2013-10-25T13:17:29.633 回答