posts - 167,  comments - 30,  trackbacks - 0
          Oracle數據庫寫法:
          --查詢第5-10條記錄
          方式一:
          select * from (select rownum myrow,t.* from efb_random_pwd t) where myrow between 5 and 10;

          以下兩種方式數據量大的時候效率好些。
          方式二:

          select * from (select rownum r,a.* from efb_random_pwd a where rownum<=20) where r>=10;   
          方式三:
          select * from efb_random_pwd where rowid in(
              select rid from (select rownum num,rowid rid from efb_random_pwd a where rownum <=10) where num > = 5);

          MySql數據庫寫法:

          select   *   from   tablename   where   LIMIT   9,10

           從10條開始取,取10條,則就是10--20


          SqlServer數據庫寫法:

          1:select top 20 * from tablename where id not exists (select top 10 * from tablename)//前20條記錄再過濾掉前10條

          2:select top10 * from (select top 20 * from order by column) order by column desc//子查詢中取20條倒序,然后從子查詢中取前10條


           


          posted on 2011-01-20 13:33 David1228 閱讀(194) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          <2011年1月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          常用鏈接

          留言簿(4)

          隨筆分類

          隨筆檔案

          文章檔案

          新聞分類

          新聞檔案

          相冊

          收藏夾

          Java

          Linux知識相關

          Spring相關

          云計算/Linux/虛擬化技術/

          友情博客

          多線程并發編程

          開源技術

          持久層技術相關

          搜索

          •  

          積分與排名

          • 積分 - 359280
          • 排名 - 154

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 开江县| 玉门市| 宜丰县| 东方市| 西林县| 行唐县| 汕头市| 巴塘县| 曲麻莱县| 卢龙县| 乐亭县| 上虞市| 鄂伦春自治旗| 巴塘县| 达孜县| 许昌市| 眉山市| 公安县| 翼城县| 客服| 大渡口区| 长寿区| 铜山县| 治多县| 乳山市| 西乌| 文水县| 昭通市| 东丰县| 两当县| 安徽省| 双桥区| 津南区| 通化县| 治县。| 昂仁县| 景宁| 云龙县| 合江县| 长顺县| 遂溪县|