SELECT * FROM res AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM res) - (SELECT MIN(id) FROM res)) + (SELECT MIN(id) FROM res)) AS id) AS t2 WHERE t1.id >= t2.id ORDER BY t1.id LIMIT 1;
select * FROM `res` AS t1 JOIN(SELECT ROUND(RAND()*((SELECT MAX(id)FROM `res` )-(SELECT MIN(id) FROM `res`))+(SELECT MIN(id) FROM `res`)) AS id )AS t2
WHERE t1.id>=t2.id ORDER BY t1.id LIMIT 1;
参考:http://blog.csdn.net/testcs_dn/article/details/10149293
时间: 2024-10-07 19:22:25