SqlServerページングの概要-抜粋

3851 ワード

sqlserver2008      limit ,      sql        mysql     ,  sqlserver2008   top,rownumber    ,                。



                     :



  sqlserver2008    sql    

top  :

sql code:



select top 10 * from table1

where id not in(select top       id from table1)



max:

sql code:



select top 10 * from table1

where id>(select max(id)

from (select top      id from table1  order by id)tt)



row:

sql code:



select *

from (

select row_number()over(order by tempcolumn)temprownumber,*

from (select top     +10 tempcolumn=0,* from table1)t

)tt

where temprownumber>    

3     ,   max  ,top  ,row  



  :

 1:row

 2:max

 3:top



  :

max:        sql,         

top:        sql,       

row:   sqlserver2000



    :

 320    ,    10   ,     2  、15   32  。



  ,top  ,max  ,row  

2 ,60ms,46ms,33ms

15 ,453ms,343ms,310ms

32 ,953ms,720ms,686ms





         sql       ,

     sql          sql  



     sql  

sql code

select * from table1



 



  5   ,  5 ,   sql  

sql code

select *

from (

select row_number()over(order by tempcolumn)temprownumber,*

from (select top 10 tempcolumn=0,* from table1)t

)tt

where temprownumber>5



 



       ?    



        sql       

 select   top     +    

     tempcolum,    

sql code

select top 20 tempcolumn=0,* from clazz





    ,         

           order by  

(    sqlserver row_number        order by)

sql code

select row_number()over(order by tempcolumn)temprownumber,*

from (      )t





    ,             

sql code

select * from (   )tt

where temprownumber>10