mysql - SQL - Percentiles -
i have 1 table:
country(id, city, freg, counts, date)    i want calculate 90th percentile of counts in specific interval of dates ($min , $max).
i've did same average (code below):
select       avg(counts) country date>= @min , date < @max       ;   how can calculate 90th percentile instead of average?
finally, group_concat for...
select substring_index(           substring_index(                 group_concat(ct.ctdivol order ct.ctdivol separator ','),',',90/100 * count(*) + 1                          ),',',-1                       ) `90th percentile`   ct   join exam e     on e.examid = ct.examid    , e.date between @min , @max  e.modality = 'ct';      
Comments
Post a Comment