Skip to content

Instantly share code, notes, and snippets.

@genert
Created June 22, 2019 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genert/785b2720e4907a7bc3090ba103c8622a to your computer and use it in GitHub Desktop.
Save genert/785b2720e4907a7bc3090ba103c8622a to your computer and use it in GitHub Desktop.
Random Key Value Between 1 and MAX
SELECT b1.*
FROM Bugs AS b1
JOIN (SELECT CEIL(RAND() * (SELECT MAX(bug_id) FROM Bugs)) AS rand_id) AS b2
ON (b1.bug_id = b2.rand_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment