从数据库里随机读取几条数据

从数据库里随机读取几条数据

 

Access: select top n * from table order by rnd(id)‘id为数据库的自动编号字段

Sql Server: select top n * from table order by newid()

MySQL:

SELECT * FROM table order by rand() limit  20; 

Oracle:

select * from table order by dbms_random.value()
posted on 2015-04-08 22:17  雪夜  阅读(250)  评论(0编辑  收藏  举报