国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

Sql server 2005帶來的分頁便利

瀏覽:154日期:2023-10-30 14:09:02

select threadid from (select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads) as T where T.Pos > 100000 and T.Pos < 100030

===========================================

如果里面的這個表cs_threads數據量超大,比如,幾億條記錄,那這個方法應該是有問題的

因為,select threadid from ( select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads ) as T where T.Pos > 100000 and T.Pos < 100030 這個語句是把select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads它全部取出來,然后在SQL的外面進行分頁的,沒在SQL2005上測試過,因為原先在ORACLE上這樣的寫法是不好的,ORACLE中這樣寫比較好:select threadid from ( select threadid, ROW_NUMBER() OVER (order by stickydate) as Pos from cs_threads a where a.pos<100030 ) as T where T.Pos > 100000

出處:blog.joycode.com/dotey/archive/2006/01/16/70493.aspx

標簽: Sql Server 數據庫
主站蜘蛛池模板: 法库县| 田林县| 泉州市| 元谋县| 庆城县| 平定县| 内丘县| 融水| 榆社县| 雅安市| 天津市| 永济市| 佛学| 永平县| 衢州市| 哈尔滨市| 牟定县| 富阳市| 泰州市| 连山| 崇阳县| 延寿县| 昭觉县| 新干县| 金川县| 瓦房店市| 田阳县| 福鼎市| 衡阳市| 晋江市| 通城县| 赤城县| 遵化市| 临潭县| 农安县| 榆林市| 武鸣县| 偏关县| 湘潭市| 凌云县| 视频|