...
mysql随机取数据,两种方法:
第一种:(速度最快!)
SELECT
*
FROM
level_test_page
WHERE
id >= (
(
SELECT
MAX(id)
FROM
level_test_page
) - (
SELECT
MIN(id)
FROM
level_test_page
)
) * RAND() + (
SELECT
MIN(id)
FROM
level_test_page
)
LIMIT 4;
第二种:order by rand();
SELECT
*
FROM
level_test_page
ORDER BY RAND()
LIMIT 3;