Random record retrieval from database

S

Subashini Kumar

How can i choose some "n" (n is gonna be fixed )records randomly from a
mysql database table from our controller?
 
K

Kaspar Schiess

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top