Quantcast
Viewing latest article 5
Browse Latest Browse All 9

作者:john

试试看这个
select a.* from t as a join (select round(rand()*(select max(id) from t)) as id from t limit 100) as b on a.id = b.id limit 10;
只要id从1开始,并基本保证自增,应该可以满足需求。但是id不连续的话,这个办法不能排除取不满10个的可能。


Viewing latest article 5
Browse Latest Browse All 9

Trending Articles