SQL 分页查询的两种思路
------分页查询------- ------要分页显示,首先确定一个排序方式。否则分页没有意义 ------分页显示7条数据----- —sql 2000 -----第一页 select top 7 * from table order by col asc ----查询出前两页的 select top ( 7 * 2 ) from table order by col asc ----第二页,思路 select top 7 * from table where col not in ( select top ( 7 * ( 2 - 1 ) ) col from table order by col asc ) order by col asc ----第五页 select top 7 * from table where col not in ( select top ( 7 * ( 5 - 1 ) ) col from table order by col asc ) order by col asc —sql 2005--------使用row_Number()实现分页 —1.为数据排序,然后编号 select * , rN = row_number ( ) over ( order by col asc ) from table –2.根据用户要查看的煤业记录条数