Hi.

for mysql < 3.23 you can do something like this.

select ID, ID*0+rand() as rand from partner order by rand limit 1

have fun.

-ravi.

-----Original Message-----
From: Chris Boot [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 3:16 PM
To: MySQL Mailing List
Subject: Selecting random rows with MySQL 3.22?


Hi,

I'm sure this has been covered before, so I'm sorry for repeating the
question.  A search of the list archives yielded nothing.

What I need to do is grab one random row from a table.  What I would do in
MySQL 3.23 is:
SELECT * FROM fid_links WHERE featured='yes' ORDER BY RAND() LIMIT 1

How can I do this 3.22?  Upgrading to 3.23 is not an option at the moment.

Thanks in advance,

--
    .-.         Chris Boot
    /v\      [EMAIL PROTECTED]
   // \\
  /(   )\    L   I   N   U   X
   ^^-^^    >Phear the Penguin<



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to