query return a randomly selected subset of records

  • Thread starter Thread starter BayDeltaDev
  • Start date Start date
B

BayDeltaDev

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.
 
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]);
 
Back
Top