方法一:
select * from tableName where id > 0 AND id < 10 order by rand()注:rand()是MySQL数据库函数,即随机排序去除的数据。
方法二:
select * from (select * from tableName order by id ASC limit 0, 10) as tmp order by rand();将(select * from tableName order by id ASC limit 0, 10)这个子查询得到数据库的前十条数据,重新赋给一个临时的表tmp,再把tmp的数据随机排序。