select ID,NAME,REPORT_ID
from
(
select *, @row:=if([email protected],@row,0)+1 as rn, @name:=name from
(select *,RAND() as trand from t) t1,
(select @row:=0,@name:='') tm2
order by name,trand
) t2
where rn<=10
select ID,NAME,REPORT_ID
from
(
select *, @row:=if([email protected],@row,0)+1 as rn, @name:=name from
(select *,RAND() as trand from t) t1,
(select @row:=0,@name:='') tm2
order by name,trand
) t2
where rn<=10