Bing Yee程序人生

关注互联网产品技术学习,应用开发~

主流数据库随机读取N条数据的方法

2012/3/20 15:45:27 类别:数据库
摘要:MSSQL,MYSQL,ACCESS中读取随机数据方法
Sql server:select top n * from 表 order by newid()

Access:Select top n * FROM 表 orDER BY Rnd(id)

mysql:Select * From 表 order By rand() Limit n

Select * from youtab where mod ( rowid , 3 ) = 0

 

mysql中随机读取数据库记录
——————————————————————————-
Select * from tablename order by rand() limit 10

sqlserver中随机读取数据库记录
——————————————————————————–
select top 10 * from tablename order by NEWID()

Access中随机读取数据库记录
——————————————————————————-
Select top 10 * FROM tablename orDER BY Rnd(PId)

PId:为你当前表的ID字段名
4553次阅读  标签:随机,Mysql,MSSQL,ACCESS
下一篇:思淇域名批量查询工具(V1.0) 正式发布
上一篇:网站被k常见问题及解决办法

共12条评论

teztjyizli(1楼)-2014/4/23 18:00:57
审核中

モンスタービーツ(2楼)-2014/5/31 18:37:01
审核中

ヴィクトリアシークレット水着(3楼)-2014/6/2 5:00:00
审核中

home(4楼)-2016/11/4 8:56:37
审核中

toms(5楼)-2014/10/27 8:28:44
审核中

京急品川グース(6楼)-2014/11/3 6:53:55
审核中

モンクレール正規店通販(7楼)-2014/11/3 17:13:28
审核中

プラダのトートバック(8楼)-2014/11/13 12:04:02
审核中

Edycrurse(9楼)-2020/4/21 20:41:33
审核中

发表评论

文章分类


友情链接