方法如下:
SQL Server:
Select TOP N * From TABLE order By NewID()
Access:
dim r
randomize
r = rnd
sql = "select top 10 * from table order by rnd(" & r & "-id)"
rnd(" & r & "-id) 其中的id是自动编号字段,可以利用其他任何数值来完成,比如用姓名字段(UserName)
select top 10 * from table order by rnd(" & r & "-Len(UserName))
MySql:
Select * From TABLE order By Rand() Limit 10
orACLE:
select *from (select *from t order by dbms_random.value) where rownum<10
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |