Created
October 27, 2017 14:37
-
-
Save Vladnev/cff0df0607b86d73ae409ff0cf2cbf24 to your computer and use it in GitHub Desktop.
Random row sql
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 r1.id | |
FROM forms AS r1 JOIN | |
(SELECT (RAND() * | |
(SELECT MAX(id) | |
FROM forms)) AS id) | |
AS r2 | |
WHERE r1.id >= r2.id | |
ORDER BY r1.id ASC | |
LIMIT 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment