作者:此人已死_0824 | 来源:互联网 | 2014-06-09 00:50
随机从数据表中取N条数据(mysql)SELECT*FROMfaqWHEREid>((SELECTMAX(id)FROMfaq)-www.2cto.com(SELECTMIN(id)FROMfaq))*RAND()+(SELECTMIN(id)FROMfaq)LIMIT9S
SELECT * FROM faq WHERE id >=
((SELECT MAX(id) FROM faq)-
www.2cto.com
(SELECT MIN(id) FROM faq)) * RAND() +
(SELECT MIN(id) FROM faq) LIMIT 9