Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2008

Tip: Looking for answers? Try searching our database.

query return a randomly selected subset of records

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BayDeltaDev - 13 Mar 2008 20:18 GMT
Hello,

I want to retrieve 10% of the records in a table, but want them to also be
randomly selected.  In other words, I want to randomly subsample a group of
records.

Does anybody know how this can be done, either in SQL or VBA?

Thank you very much.
Duane Hookom - 13 Mar 2008 20:58 GMT
This question would have been more appropriate in the MS Access Queries NG.
You can select the TOP 10 PERCENT of the records ordered by the RND()
function like:

SELECT TOP 10 PERCENT Rnd([OrderID]) AS Expr1, Orders.*
FROM Orders
ORDER BY Rnd([OrderID]);

Signature

Duane Hookom
Microsoft Access MVP

> Hello,
>
[quoted text clipped - 5 lines]
>
> Thank you very much.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.