select threadid from
(
select threadid, row_number() over (order by stickydate) as pos from cs_threads
) as t
where t.pos > 100000 and t.pos < 100030
===========================================
如果里面的这个表cs_threads数据量超大,比如,几亿条记录,那这个方法应该是有问题的
因为,select threadid from
(
select threadid, row_number() over (order by stickydate) as pos from cs_threads
) as t
where t.pos > 100000 and t.pos < 100030
这个语句是把select threadid, row_number() over (order by stickydate) as pos from cs_threads它全部取出来,然后在sql的外面进行分页的,没在sql2005上测试过,因为原先在oracle上这样的写法是不好的,oracle中这样写比较好:select threadid from
(
select threadid, row_number() over (order by stickydate) as pos from cs_threads a where a.pos<100030
) as t
where t.pos > 100000
新闻热点
疑难解答