Re: SQL - Select rand() ?
| From: | Steve Lawson | Date: | Tue, 17 Apr 2001 23:15:25 +0000 |
| Subject: | Re: SQL - Select rand() ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49078@lists.php.net to get a copy of this message | ||
Sup,
In the newer versions of mySQL, you can get random results like
SELECT id FROM table ORDER BY rand() LIMIT 0,1
SL.
----- Original Message -----
From: "James, Yz" <liljim@btconnect.com>
To: <php-general@lists.php.net>
Sent: Tuesday, April 17, 2001 2:55 PM
Subject: [PHP] SQL - Select rand() ?
> Hi Guys,
>
> If I wanted to retrieve just one field randomly from a MySQL table, would
I
> just use something like:
>
> "SELECT RAND(id) FROM table .... LIMIT 0,1" ?
>
> I suppose the best thing for me to do would be to try it, but I am fast
> losing the will to stay awake ;)
>
> Thanks, as always,
>
> James.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>