(RANKAVG(arg,column,table/view,order))
Returns the statistical rank of a given value, within a supplied array of values. If there are duplicate values in the list, the average rank is returned.
finds the rank for the first occurrence of the value
arg - specifies the item to rank. The value must be TEXT. The CTXT may be used, if needed.
column - specifies the column to compare arg to. The value must be TEXT.
table/view - specifies the table/view which contains the column The value must be TEXT.
order - 0 for ranking from highest to lowest (like for scores)
- 1 for ranking from lowest to highest (like for race times)
The resulting variable value is the DOUBLE data type.
After the RANKAVG function is used, the ProcRANKAVG stored procedure will be loaded into the database, if the procedure does not already exist.
The below calculates the average rank of 1534 as 5 in a list of test scores.
SET VAR vRankAvg DOUBLE = (RANKAVG('1534','Score','TestScores',1))
SHOW VAR vRankAvg
5.