Last active
December 12, 2015 09:39
-
-
Save apphp-snippets/4753309 to your computer and use it in GitHub Desktop.
Here the simplest way of selecting random rows from the MySQL database with using "ORDER BY RAND()" clause in the query.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- source: http://www.apphp.com/index.php?snippet=mysql-selecting-random-row | |
SELECT * FROM TABLE | |
ORDER BY RAND() | |
LIMIT 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment