How to find random records in a subset?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, and then use MySQL's "in" command to find them. I can't use "order by rand()" due to its performance hit.

But I have to take it one more step: I want to first limit my found set to those matching a different search criteria, and then find 50 of those.

Anyone? Can this be done all within MySQL, or is it going to require some humongo PHP arrays?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux