Home >Database >Mysql Tutorial >随机从数据表中取N条数据(mysql)_MySQL

随机从数据表中取N条数据(mysql)_MySQL

WBOY
WBOYOriginal
2016-06-01 13:48:081088browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn