select a.* from (SELECT (@i:=@i+1) i, fixed_duration FROM issue isu, (SELECT @i:=0) as i
where isu.is_valid = 'y'
ORDER BY fixed_duration desc) a
WHERE a.i > (select count(*)*0.2 from issue issu where issu.is_valid ='y');
select a.* from (SELECT (@i:=@i+1) i, fixed_duration FROM issue isu, (SELECT @i:=0) as i
where isu.is_valid = 'y'
ORDER BY fixed_duration desc) a
WHERE a.i > (select count(*)*0.2 from issue issu where issu.is_valid ='y');