mysql:select * from tablename order by rand() limit 10
sqlserver:select top 10 * from tablename order by NEWID()
ORACLE:使用 dbms random value的一种方法
SQL> select *from (select *from t order by dbms_random.value) where rownum<10;
A
----------
39
101
134
5
83
97
96
140
81
已选择9行。
SQL> select *from (select *from t order by dbms_random.value) where rownum<10;
A
----------
27
118
141
103
128
10
142
68
74
有人说这是一种效率最差的方法,恳请告知比这更好的解决方案!
ACCESS(一):
yourstr="*1*3*4*6*12*...."ACCESS(二):
<%本文地址:http://com.8s8s.com/it/it19330.htm