RE: [PHP] retrieving random data from mysql database
| From: | David Freeman | Date: | Mon, 15 Jul 2002 11:52:14 +0000 |
| Subject: | RE: [PHP] retrieving random data from mysql database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107696@lists.php.net to get a copy of this message | ||
> When you say,
> Order by RAND()
> I would think the "Order by" construct expects a column name.
> In your case, it gets a decimal value.
> How does "Order by" treat decimal values?
> Oh, I just checked the manual:
> In MySQL Version 3.23, you can, however, do: SELECT * FROM
> table_name ORDER BY RAND()
> I still don't understand how does "Order by" work with a
> decimal value!!!
I don't pretend to have all the answer. I just know that I had reason
to work this one out for myself a while back and when I consulted the
MySQL manual it gave sample code on what to do in MySQL to achieve this
result. I accepted that fact and used it. I haven't needed any deeper
information on this one so I haven't looked.
I suspect if you really want to know how it works then you'll have to
ask this question again on a MySQL-specific list - and perhaps even a
MySQL developers list.
CYA, Dave