SELECT * FROM `sucai_js` ORDER BY RAND() LIMIT 1
优化后:
SELECT *
FROM `sucai_js`
WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM `sucai_js` )
ORDER BY id LIMIT 1;
来源:http://erdangjiade.com/topic/55.html 沐浴春风 2016-04-19 13:42浏览(349)
SELECT * FROM `sucai_js` ORDER BY RAND() LIMIT 1
优化后:
SELECT *
FROM `sucai_js`
WHERE id >= (SELECT FLOOR( MAX(id) * RAND()) FROM `sucai_js` )
ORDER BY id LIMIT 1;
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群