Originally Posted by Old Pedant
But it's not terribly efficient.
I would be strongly tempted to do this in PHP/JSP/ASP code, instead.
Read the 4 records into an array and then just pick a random array element 5 times.
I agree - as more than the total number of records in the table is needed it will always be more efficient to just rread in all the entries and then select them without having to read the same record from the database more than once.
Only when the number of records required is significantly less than the number of entries in the table would 'sorting' the table in the database be more efficient and that too becomes inefficient when you have a large enough number of records and only need to retrieve a small number.
Helping others to solve their computer problem at http://www.felgall.com/