--对一个表取任意随机数 SELECT * FROM TMP_XF_TEST WHERE ID >= (SELECT FLOOR(RAND() * (SELECT MAX(ID) FROM TMP_XF_TEST))) order by id LIMIT 1;
--有条件性的取随机数 SELECT * FROM TMP_XF_TEST WHERE ID >= (SELECT FLOOR(RAND() * ((SELECT MAX(ID) FROM TMP_XF_TEST WHERE GID = 9) - (SELECT MIN(ID) FROM TMP_XF_TEST WHERE GID = 9))) + (SELECT MIN(ID) FROM TMP_XF_TEST WHERE GID = 9)) AND GID = 9 ORDER BY ID LIMIT 1;
SELECT ROUND((0.5-RAND())*2*5) #注释 #0.5-rand()可以得到-0.5 至 +0.5的随机数 #(0.5-rand())*2可以得到-1 至 +1的随机数 #(0.5-rand())*2*5可以得到-5 至 +5的随机数 #ROUND((0.5-RAND())*2*5)可以得到-5 至 +5的随机整数