in reply to Random Picks

You can use a relatively new feature of MySQL to do this (no perl needed):
SELECT ssn FROM ssn_table ORDER BY RAND LIMIT 3
That is, the ordering by RAND is the trick. I forget which version of MySQL introduces it, but if you don't have it, the other suggestions presented are a bit more portable.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re: Re: Random Picks
by tune (Curate) on May 10, 2001 at 01:52 UTC
    I tried this with a 250,000 records mysql table on a really fast machine (one of our production servers), and 20 random records costed 17 seconds to process, so be very careful!

    --
    tune