您的位置:首页 > 数据库 > Oracle

Sql server,Oracle,MySQL随机查询记录

2007-03-23 22:28 706 查看
Sql server,Oracle,MySQL随机查询记录

2006-11-20 12:42
作者:罗代均 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: