Created
February 11, 2015 08:10
-
-
Save akeinhell/b4ee02e6ab8d128fb1c4 to your computer and use it in GitHub Desktop.
Выбор случайной строки в Mysql
This file contains 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
SELECT FLOOR(count(*)*RAND()) INTO @max FROM table; | |
PREPARE STMT FROM 'SELECT * FROM table LIMIT ?,1'; | |
EXECUTE STMT USING @max; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment