How can i choose some “n” (n is gonna be fixed )records randomly from a
mysql database table from our controller?
Hi,
How can i choose some “n” (n is gonna be fixed )records randomly from
a mysql database table from our controller?
What I usually do is compute a column using a random function (mysql
has one) and then order by that column. You can use LIMIT to only
retrieve some results.
This is going to be CPU/Disk intensive if your table is very large.
kaspar