SQL Server--实现 Limit m, n 的功能

时间:2021-01-02 13:22:13

1 如果要查询上述结果中第 7 条到第 9 条记录,则相应的SQL语句是:

select top 3 id from tablename  
where id not in (
select top 6 id from tablename
)

2 取第m条到第n条记录:

select top (n-m+1) id from tablename  
where id not in (
select top m-1 id from tablename
)

摘自:http://blog.csdn.net/sjzs5590/article/details/7337541
未完待续。。。