devinwang

  博客园 :: 首页 :: 联系 :: 订阅 订阅 :: 管理
  6 Posts :: 0 Stories :: 1 Comments :: 0 Trackbacks

公告

 作者:罗代均 ldj_work#126.com,转载请保持完整性

1. Oracle,随机查询20条

select * from

(
 select  *  from 表名
 order by dbms_random.value

)
 where rownum <= 20;

 

2.MS SQL Server,随机查询20条

select top 20  * from  表名order by newid()

 

3.My SQL:,随机查询20条

select  *  from  表名 order by rand() limit 20

posted on 2008-09-02 22:56 Devin 阅读(1079) 评论(0) 编辑 收藏