select top 3 * from Goods
where ID not in
(select top 2 ID from Goods order by ID asc ) order by ID asc
where ID not in
(select top 2 ID from Goods order by ID asc ) order by ID asc
查看第3-5条记录
或者
select top 2 * from Goods
where ID not in
(select top 4 ID from Goods ) --这里是查第 5-6条记录
where ID not in
(select top 4 ID from Goods ) --这里是查第 5-6条记录
SQL Server
从数据库表中的第M条记录开始取N条记录,利用Top关键字:注意如果Select语句中既有top,又有order by,则是从排序好的结果集中选择:
SELECT *
FROM ( SELECT Top N *
FROM (SELECT Top (M + N - 1) * FROM 表名称 Order by 主键 desc) t1 ) t2
Order by 主键 asc