SELECT
*
FROM(
SELECT
@i:= @i + 1 as nums , -- 排名
a.`数值`,
(
SELECT floor(COUNT(1)*0.3) nums from zyw_test_20200609_01
) as hangs -- 计算排名前30%的最大名次
FROM
zyw_test_20200609_01 a,
(SELECT @i:= 0) b
ORDER BY CAST(a.`数值` AS signed) asc
)tb
where tb.nums <= tb.hangs -- 获取排名前30%的行
注:该SQL是mysql的语法