SQL Server CE-选择随机行 [英] SQL Server CE - Select random rows
本文介绍了SQL Server CE-选择随机行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从表中选择随机行?
How do you select a random rows from a table?
例如,如果表中有1000行符合我想要的条件,我只想选择20个随机行.
For example, if there are 1000 rows in a table matching the criteria that I want, I want to select just 20 random ones.
与TOP类似,但随机.
Like TOP, but random.
谢谢,这是针对SQL Server CE 3.5!
Thanks, and this is for SQL Server CE 3.5!
推荐答案
如何?
SELECT TOP(20) * FROM myTable ORDER BY NEWID()
这篇关于SQL Server CE-选择随机行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文