You can't do "ORDER BY RAND()" prior to version 3.23...

On your 3.22.32 version do something like:

SELECT  column_name*0+RAND() AS rnd FROM table_name WHERE IsActive=1 ORDER
BY rnd LIMIT 1;

Gurhan

-----Original Message-----
From: Soheil Shaghaghi [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 4:26 PM
To: [EMAIL PROTECTED]
Subject: RAND and MySQL version!


Hello All,
I am running 2 MySQL servers, one on Linux, and the other on FreeBSD.
Linux, MySQL version: 3.23.49
FreeBSD, MySQL version: 3.22.32

Problem:

The following code runs on the newer version of MySQL, and Linux, but when I
run it on the other server, I get sql error.

SELECT ID,Headlines,IsActive FROM DATABASE WHERE IsActive=1 ORDER BY RAND()
LIMIT 1

Can anyone please tell me if it's the version of MySQL causing this problem
or something else?

Is there anyway to get around this, without upgrading MySQL?

Thanks so much,
Soheil


---------------------------------------------------------------------
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