sqlserver的分页语句


SELECT *
FROM
(
SELECT *,ROW_NUMBER() OVER (ORDER BY ID asc) AS RowNum
FROM qnfh
) AS T
WHERE T.RowNum> 0 and T.RowNum<= 10

 

 

SELECT *
FROM
(
SELECT *,ROW_NUMBER() OVER (ORDER BY ID asc) AS RowNum
FROM qnfh
) AS T
WHERE T.RowNum> 10 and T.RowNum<= 20

 

 

 

 

取出sql表中第31到40的记录(以自动增长ID为主键)

sql server方案1:
select top 10 * from qnfh where id not in (select top 30 id from qnfh order by id ) order by id
sql server方案2:
select top 10 * from qnfh where id in (select top 40 id from qnfh order by id) order by id desc

sqlserver的分页语句,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。