in reply to Is there a good way of retrieving entries randomly from a database (MySQL perhaps)?
You can select any number of random rows by limiting the results of your query:
It'll be much faster and more efficient than pushing all the results into an array and dumping them into a temporary table. That seems like too much work for the task you described, unless there's a good reason for the temp table.SELECT question, answer FROM table ORDER BY RAND() LIMIT 1
--
perl -MO=Deparse -e"u j t S n a t o e h r , e p l r a h k c r e"
|
---|
In Section
Seekers of Perl Wisdom