order by newid() 随机查询

order by newid() 随机查询,第1张

概述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()函数将创建一个 uniqueid

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() 随机查询所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1180098.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存