Mysql:select * from [tablename] order by rand() limit 10 

Sql Server:select top 5 * from [tablename] order by NEWID() 

Access:select top 5 * from [tablename] order by rnd(id),其中id是自动编号的字段。在vb+access可以随机,但在asp里却没法得到随机的结果。可能是asp有缓存的结果吧,因此,需要修改一下这条语句,改为下面的方式: 
   randomize 
    select top 5 * from [tablename] order by rnd(-(id+rnd())) 

posted on 2015-11-26 11:58  邢帅杰  阅读(236)  评论(0编辑  收藏  举报