submitted by: Snippissimo
MySQL: Get Random Rows
This simple query shows how to select random rows from a MySQL database table.
code snippet:
SELECT * FROM mytable ORDER BY RAND() LIMIT 20 notes:
This example will fetch 20 random rows from 'mytable'. If you only want one record, set the LIMIT value to 1.



