To pick one item at random what you want is
Select foo from bar Where ID = rand() * scale
To order them randomly, I seem to recall that there was an example of how to
do it in the mySQL manual.
-- Erik Perrohe
----- Original Message -----
From: "Per Andreas Buer" <[EMAIL PROTECTED]>
To: "Jule" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Sunday, May 19, 2002 2:55 AM
Subject: Re: random order by id
> Jule <[EMAIL PROTECTED]> writes:
>
> > Hey guys,
> > i have a db and a table with id and questions
> >
> > now i want these questions to be listed in a random order, is there a
way to
> > format my SQL query or do i need some PHP work to?
>
> SELECT foo FROM bar ORDER BY rand();
>
> Just to pick one:
>
> SELECT foo FROM bar ORDER BY rand() LIMIT 1;
>
>
> --
> Per Andreas Buer
>
> ---------------------------------------------------------------------
> 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