法一:SELECT * FROM table_name ORDER BY rand() LIMIT 5;
法二(mysql4.1.*支持):SELECT *FROM table_name AS r1 JOIN(SELECT ROUND(RAND() *(SELECT MAX(id)FROM table_name)) AS id)AS r2WHERE r1.id >= r2.idORDER BY r1.id ASCLIMIT 5;
法二(mysql4.1.*支持):SELECT *FROM table_name AS r1 JOIN(SELECT ROUND(RAND() *(SELECT MAX(id)FROM table_name)) AS id)AS r2WHERE r1.id >= r2.idORDER BY r1.id ASCLIMIT 5;