sqlserver 分頁

1.rowNum

select * from 

(select *,ROW_NUMBER() over (order by id ) as rowNum from BD_city) as t

where t.rowNum between 3*(2-1)+1  and 3*2

2.top

 SELECT * FROM ( SELECT TOP 3 * FROM (SELECT  top 40 *  FROM 
 (select t1.*,t2.satellite_id
 from table1 t1 left join table2 t2) 
 as mm ORDER BY id asc) AS TEMPTABLE1   ORDER   BY id desc)AS TEMPTABLE2 ORDER BY id ASC

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章