----- Original Message -----
From: Derick Dorner
To: [EMAIL PROTECTED]
Sent: Tuesday, July 17, 2001 3:11 PM
Subject: tricky RAND() function...
I am using MySQL 3.22, and need to know how to randomly select a record, therefore I
can't just use the ORDER BY RAND() clause, because of my version. so i do this:
SELECT field1,field2*0+RAND() as rand_col FROM TableName WHERE field3=5 ORDER BY
rand_col;
--according to paul dubois' book I have to do that field2*0+rand to override mysql's
query optimizer...?
This works great randomly selecting records, but it obviously also returns the
rand_col column, which I can't have (I have to output the data (a picture) straight
into a web browser). How can I either re-write this statement or "hide" that rand_col
column from showing up?
all i want to do is randomly select one column using mysql 3.22, is this that hard?
thanks in advance!
-derick