Rumah >pangkalan data >tutorial mysql >随机从数据表中取N条数据(mysql)_MySQL
bitsCN.com
随机从数据表中取N条数据(mysql) SELECT * FROM faq WHERE id >= ((SELECT MAX(id) FROM faq)- (SELECT MIN(id) FROM faq)) * RAND() + (SELECT MIN(id) FROM faq) LIMIT 9 bitsCN.com