Java Blog for Alex Wan

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

          統(tǒng)計(jì)

          留言簿(10)

          BlogJava

          Blogs

          DIV+CSS

          JQuery相關(guān)

          友情鏈接

          常去的地方

          數(shù)據(jù)供應(yīng)

          閱讀排行榜

          評(píng)論排行榜

          從SQLSERVER與ORACLE數(shù)據(jù)庫中隨機(jī)取記錄

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

          select top n * from tableName order by newid()

          在oralce中,從數(shù)據(jù)表中隨機(jī)取出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 閱讀(506) 評(píng)論(0)  編輯  收藏 所屬分類: 小筆記數(shù)據(jù)庫

          主站蜘蛛池模板: 通山县| 南城县| 新和县| 上饶市| 和平区| 泰来县| 伊宁县| 汉寿县| 仪陇县| 拉孜县| 大渡口区| 读书| 新昌县| 江陵县| 德安县| 凤城市| 汪清县| 萨嘎县| 黔江区| 泉州市| 嘉义县| 宜宾县| 黄浦区| 温宿县| 连平县| 高邑县| 公安县| 连南| 沙坪坝区| 兴安盟| 郧西县| 秦安县| 嵊州市| 衡阳县| 镇坪县| 大荔县| 游戏| 玛沁县| 榕江县| 抚松县| 万安县|