sql Server:
Select top N * From table Order By NewID()
vIEw plaincopy to clipboardprint?
Select top N * From table Order By NewID()
Select top N * From table Order By NewID()
NewID()函数将创建一个 uniqueIDentifIEr 类型的唯一值。上面的语句实现效果是从table中随机读取N条记录。
Access:
Select top N * From table Order By Rnd(ID)
vIEw plaincopy to clipboardprint?
Select top N * From table Order By Rnd(ID)
Select top N * From table Order By Rnd(ID)
Rnd(ID) 其中的ID是自动编号字段,可以利用其他任何数值来完成,比如用姓名字段(Username)
Select top N * From table Order BY Rnd(Len(Username))
vIEw plaincopy to clipboardprint?
Select top N * From table Order BY Rnd(Len(Username))
Select top N * From table Order BY Rnd(Len(Username))
MysqL:
Select * From table Order By Rand() limit 10
vIEw plaincopy to clipboardprint?
Select * From table Order By Rand() limit 10
Select * From table Order By Rand() limit 10
postgresql:
select * from glxt022 order by random() limit 5 vIEw plaincopy to clipboardprint?select * from glxt022 order by random() limit 5
总结以上是内存溢出为你收集整理的order by newid() 随机查询全部内容,希望文章能够帮你解决order by newid() 随机查询所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)