Hey,
Is it possible to have something randomly picked from the MySql database.
I have one table, full of links to images On my php page i only want one to be shown, but it to be random
get me?
select * from table order by rand() limit 1
A good suggestion, but can be slow on large tables.
http://www.hvt-automation.nl/yapf/faq.php?cmd=viewitem&itemid=68
good point vincent, have you done any benchmarking to find the practical limits of the first method?
Nope, I haven't yet.
But that's mainly because I never had the need to select random records :-)
Feel free to try it out and let us know what you found. Oh, and no index cheating!
lol, the tables i pull random rows from are very small, i have no need for it myself. when time allows, i will. Thanx Vincent