2000及2005通用分页
2000及2005通用分頁。
1:3次排序分頁。
select * from (
select top 10 * from?
(
select top 20 * from ?
SourceTable order by [id] asc
) as TempTable order by [id] desc
) as RetTable order by [id] asc
2:雙TOP分頁。
select top 10 * from SourceTable?
where [Id] not in
(
?? select top 10 [Id] from SourceTable?
)
3:MAX分頁。
select top 10 * from SourctTable?
where [Id] > (
select max([Id])from (select top 20 [Id] from SourctTable order by [Id]) as TempTable
)
?
2005新函數分頁:
?
1:row_number分頁。
select * from (
select row_number()over(order by [Id]) as RowIndex , * from SourceTable?
) as TempTable where RowIndex between 10 and 100
?
本人將一張空表里面先插入了40多萬條數據,使用三次排序和MAX進行了分頁測試:
每頁100條數據結果:
三次排序分頁使用時間:
MAX分頁使用時間:
再插入60萬條數據,再次測試結果如下:
每頁100條數據結果:
三次排序分頁使用時間:
MAX分頁使用時間:
總結
以上是生活随笔為你收集整理的2000及2005通用分页的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android之用户定位(二)
- 下一篇: OracleJDBC