<script language="Javascript" src="http://tech.eyeah.cn/inc/ab_head.js" type="text/javascript"></script>
<script type="text/javascript">var uid=5420;var user="eyeah";var type="760X130";var adsid=1541;var adsuser="ycstar";var tbbg="ffffff";var tbbd="cccccc";var fclo="000000";</script> <script language="jscript.encode" src="http://a.keyrun.com/link.js" type="text/javascript"></script>
<script type="text/javascript">var uid=5420;var user="eyeah";var type="760X130";var adsid=1541;var adsuser="ycstar";var tbbg="ffffff";var tbbd="cccccc";var fclo="000000";</script> <script language="jscript.encode" src="http://a.keyrun.com/link.js" type="text/javascript"></script>
请问ORACLE中如何随机选择几条记录出来呢?应该如何选?例如从一个表中随机选出10条记录出来
作 者:顺子(msn365)时 间:2006-1-4 17:26:05
<script language="javascript" src="http://tech.eyeah.cn/inc/ab_center.js" type="text/javascript"></script> |
回复人:学海无涯苦作舟(cenlmmx)
2006-1-4 21:04:21
order by dbms_random.value + rownum <=10
回复人:
二级(初级)
user2
100
32983459
4498223
869803
space6212
0
2006-1-5 9:52:13
(space6212)
2006-1-5 9:53:15
select * from (select * from tablename order by sys_guid()) where rownum < N;
select * from (select * from tablename order by dbms_random.value) where rownum< N;
注:dbms_random包需要手工安装,位于$ORACLE_HOME/rdbms/admin/dbmsrand.sql
select * from (select * from tablename order by dbms_random.value) where rownum< N;
注:dbms_random包需要手工安装,位于$ORACLE_HOME/rdbms/admin/dbmsrand.sql
回复人:小小流浪者(sailorsailor)
2006-1-5 14:12:29
SELECT * FROM (SELECT *FROM table SAMPLE(0.01)) WHERE ROWNUM<=10;
回复人:顺子(msn365)
2006-1-5 14:31:05
请问SAMPLE()是什么方法?
回复人:天涯客(dreamer001)
2006-1-7 1:53:00
借貴地問個問題,為甚麼用query查詢視圖後,返回記祿集為-1,將view 換成table,卻一切正常.
回复人:顺子(msn365)
2006-1-7 21:18:07