DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Selecting a Random Row from Table in MySQL
-- source: http://www.apphp.com/index.php?snippet=mysql-selecting-random-row SELECT * FROM TABLE ORDER BY RAND() LIMIT 1
Here the simplest way of selecting random rows from the MySQL database with using "ORDER BY RAND()" clause in the query.
Comments
Michael Molo replied on Wed, 2013/02/20 - 8:30pm
http://www.fence-system.com/