Here is an off-the wall appraoch:
Assuming you have a column in the table which is a numeric ID called ID
Add a new column called SortOrder, as long integer
Run an update query against the table just before you want to read the random rows.
The update would be
Update thetable set SortOrder =(Rnd()*999999) +[ID]
By including ID in the query, the random function is called on every line. So all rows gets a random number (maybe some duplicates, but that wont be a problem)
Then, you just Select * from thetable order by SortOrder;
If you want random numbers of rows, noble the update query so that it generates numbers in a small range.
Update thetable set SortOrder = ((Rnd()*999999) +[ID]) mod 10;
Then select where SortOrder = 6 or something. You will get a different set of values and a different number of rows each time.
Enter your message below
Sign in or Join us (it's free).