select a.*
from table a
where 10 > (select count(*) from table b where b.dif_distance = a.dif_distance and b.id > a.id ) 
order by a.id
-- 按照dif_distance分组, 取前10条,"b.id > a.id" 表示取按照id取最后的十条