  | |  | Selecting random record problem | Selecting random record problem 2004-12-21 - By Denis Gerasimov
Back
Hello,
I think that question was asked many times on the list but I searched archives and found nothing suitable for me.
That's my problem: I need to select one (two, three...) random records from a table.
Here's what I do:
SELECT * FROM banners ORDER BY RAND() LIMIT 1
It works for persistent connections BUT it returns the same record if the connection is reestablished every time after running this query! (This takes place is PHP scripts, for example.)
I also tried using sequence seed but that didn't help too:
SELECT * FROM banners ORDER BY RAND(NOW()) LIMIT 1
MySQL version is 3.23.
Any ideas?
Best regards, Denis Gerasimov Outsourcing Services Manager, VEKOS, Ltd. www.vekos.ru
-- MySQL Windows Mailing List For list archives: http://lists.mysql.com/win32 To unsubscribe: http://lists.mysql.com/win32?unsub=mysql@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |