日期:2014-05-18  浏览次数:20573 次

一条sql语句的理解
select * from(select ROW_NUMBER() over (order by unit_price desc) as rownum,*from Price)  
as temp where rownum between 1 and 10 
请各位大神们解释一下,g感激不尽呀

------解决方案--------------------
SQL code

select * from
(
select ROW_NUMBER() over (order by unit_price desc) as rownum,* from Price
) as temp 
where rownum between 1 and 10

------解决方案--------------------
探讨

[Quote=引用:]
SQL code


select * from
(
select ROW_NUMBER() over (order by unit_price desc) as rownum,* from Price
) as temp
where rownum between 1 and 10


这是一个嵌套查询。
里面是查询price的数据,并按照uni……

------解决方案--------------------
先用unit_price排序之后,然后给前几页的每一个列给一个编号,然后再取编号为1-10的数据 

Sql Server2005 分页存储过程, 用TOP和Row_Number的性能实测比较