Request to get random records from MS Access
Possible duplicate:
How to get random record from MS Access database
In my project I looked at a scenario where I have to write records from MS Access table RANDOMLY. What query should be used to retrieve records in a random database?
+3
source to share
1 answer
Assuming in the table MyTable
you have a primary key ID
in a field that is an auto-increment integer, you can do something like this to get, for example, 10 random records from MyTable
:
SELECT Top 10 *
FROM (SELECT *,
Rnd(ID) AS RandomValue
FROM MyTable)
ORDER BY RandomValue
Edit:
Found another similar answer: How to get random record from MS Access database
+4
source to share