Return to Snippet

Revision: 10398
at December 24, 2008 21:00 by liuran


Initial Code
SELECT * 
FROM `table` AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM `table`)-(SELECT MIN(id) FROM `table`))+(SELECT MIN(id) FROM `table`)) AS id) AS t2 
WHERE t1.id >= t2.id 
ORDER BY t1.id LIMIT 1;

Initial URL

                                

Initial Description
get some random record from mysql quickly。

Initial Title
get random record from mysql

Initial Tags
mysql

Initial Language
SQL