On Mon, 3 Jun 2002, Philip Newton wrote:

PN> On 02 Jun 2002 09:14:57 -0500, [EMAIL PROTECTED] (Roberto Andrade
PN> Fonseca) wrote:
PN>
PN> > SELECT quotedId, quote, author from your_table order by random() limit
PN> > 1;
PN>
PN> That doesn't look so good to me... it looks a bit like "sort {
PN> int(rand(3))-1 } @a" in Perl. Most sorts don't like comparison functions
PN> that sometimes say 2 is less than 4 and sometimes say 2 is greater than
PN> 4 (which will happen if you let the comparison be random).

Hmm, I've used this in postgres before without problems.  Not
sure about other databases.  My understanding is that the
random() function will only be called once per row in the table,
and then the resulting table is sorted.

-- 
[EMAIL PROTECTED]

Reply via email to