Possible duplicate:Alerternative to MySQL Order by Rand ()
What is an efficient query method for random result sets in the following scenarios:
Particularly interested in MySQL, but may be a reason to try something else.
(The primary key is a solid integer AUTO_INCREMENT.)
Edit: As noted by OMG Ponies: This does not scale at all. Thanks OMG.
Try using
ORDER BY RAND()
So...
SELECT * FROM `table` ORDER BY RAND() LIMIT 1 SELECT * FROM `table` ORDER BY RAND() LIMIT n SELECT * FROM `table` ORDER BY RAND()
Source: https://habr.com/ru/post/1734821/More articles:How to create a window based only on screen size, not including the border of the window with C ++ / Windows? - c ++У меня есть отсортированный список пар ключ/значение и хочу найти значения, смежные с новым ключом - collectionsDoes Linux c code work differently under gdb if it runs autonomously? - cHow to call jquery validation function outside of form - javascriptDoes Joomla have a content search? - joomlaReading the next line using LINQ and File.ReadAllLines () - fileaction will not be performed on CCSprite from ccTouchBegan in cocos2d for iphone - iphoneASP.NET MVC - State and Architecture - asp.net-mvcimplementation of pagerank in java - javaWhy doesn't this ruby code compare regular expression? - ruby | fooobar.comAll Articles