Java Blog for Alex Wan

          Let life be beautiful like summer flowers and death like autumn leaves.

          導航

          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          隨筆分類(148)

          文章分類

          隨筆檔案(104)

          統計

          留言簿(10)

          BlogJava

          Blogs

          DIV+CSS

          JQuery相關

          友情鏈接

          常去的地方

          數據供應

          閱讀排行榜

          評論排行榜

          從SQLSERVER與ORACLE數據庫中隨機取記錄

          在sql server中,從數據表中隨機取出n條記錄,使用以下SQL語句:

          select top n * from tableName order by newid()

          在oralce中,從數據表中隨機取出n條記錄,使用以下SQL語句

          select   *   from   (select   tableName .*,dbms_random.random  as randomKey   from tableName  order  by   randomKey)    
            
          where   rownum<=n


          Let life be beautiful like summer flowers and death like autumn leaves.

          posted on 2008-08-21 16:53 Alexwan 閱讀(503) 評論(0)  編輯  收藏 所屬分類: 小筆記數據庫

          主站蜘蛛池模板: 察哈| 凤山市| 定边县| 开原市| 科尔| 松滋市| 公主岭市| 瑞丽市| 多伦县| 资源县| 保定市| 津市市| 北碚区| 新巴尔虎左旗| 金华市| 资源县| 原阳县| 民权县| 溧阳市| 克东县| 额尔古纳市| 安新县| 清河县| 清远市| 尉氏县| 鸡东县| 布拖县| 剑河县| 永定县| 秦皇岛市| 旬阳县| 巨野县| 嵩明县| 青河县| 桦南县| 武夷山市| 博白县| 酒泉市| 桦甸市| 瓦房店市| 汶上县|