求个带条件的分页 查询 SQL语句
比如说查询 头 10~20 条的,下面这个样子的代码不要!!!
declare @page_size int;
declare @page_num int;
--比如:每页10条记录
set @page_size = 10;
--比如:先取第1页
set @page_num = 1;
select *
from
(
select *,
(row_number() over(order by @@servername) - 1) / @page_size as pagenum
from from biao
)t
where pagenum = @page_num - 1
;with TT
(
select * ,row_number()over(partition by 分组列 order by getdate()) as num
from TB)
select * from TT where num between 10 and 20 and ...lz的一些条件
with TT as
(select *,
row_number() over(partition by pname order by getdate()) 'num'
from Project)
select *
from TT
where num between 10 and 20