SQLServer分页
1.select top 页大小 * from table where id not in (select top 页大小 * (页数-1) id from table order by id) order by id;
2.select top 页大小 * from table where id > (select isnull(max(id),0) from (select top 页大小 * (页数-1) id from table order by id)a) order by id;
isnull()函数:max(id) 查询ID的最大值,如果为null 返回0,如果不为null 返回max(id)的值。第二种分页的效率比第一种高。