0
我想計算MYSQL中的百分位數。請讓我知道這是計算百分比的正確方法。使用MYSQL計算百分位數
Set @percentile = 30;
select firnum, a.rownum
from
(select firnum, @rownum := @rownum + 1 AS rownum
from (select firnum from per order by firnum) as a,
(SELECT @rownum := 0) b) as a,
(select round((COUNT(*) * @percentile)/100) percen from per) as b
where a.rownum = b.percen;