MySQL 给查询结果带上序列号 No

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');

你可能感兴趣的:(MySQL 给查询结果带上序列号 No)