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!!!
David Freeman <[EMAIL PROTECTED]> wrote:
> can you teach me how to retrieve random data from my
> database? like for example...i have a list of names on my
> database and i'd like to retrieve only one name at a
> time..randomly. how do i go about this?
This is really a database question rather than a php question and you
haven't said which database you're using so it's hard to give a
definitive answer. In MySQL you'd do something like this:
Select * from some_table where some_condition order by RAND() limit 1;
That would select one random row out of all rows that meet
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes